lachlanarthur/psr16-wordpress-transients

使用WordPress transients作为PSR-16缓存。

1.1 2020-03-08 05:45 UTC

This package is auto-updated.

Last update: 2024-09-08 15:59:17 UTC


README

使用WordPress transient API作为PSR-16缓存

composer require lachlanarthur/psr16-wordpress-transients
use LachlanArthur\Psr16WordPressTransients\WordPressTransientAdapter

new WordPressTransientAdapter( 'prefix-', MONTH_IN_SECONDS );

注意

  • 此缓存不能存储nullfalse。这是因为WP transient API在缓存未命中时返回false,而PSR-16规范在缓存未命中时必须返回null

  • 键长度限制为172个字符,包括前缀,详见此处