lachlanarthur / psr16-wordpress-transients
Use WordPress transients as a PSR-16 cache.
Installs: 1 007
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- psr/simple-cache: ^1.0
This package is auto-updated.
Last update: 2024-05-08 15:17:25 UTC
README
Use the WordPress transient API as a PSR-16 cache
composer require lachlanarthur/psr16-wordpress-transients
use LachlanArthur\Psr16WordPressTransients\WordPressTransientAdapter new WordPressTransientAdapter( 'prefix-', MONTH_IN_SECONDS );
NOTES
-
This cache cannot store
null
orfalse
. This is because the WP transient API returnsfalse
for a cache miss, and the PSR-16 spec must returnnull
for a cache miss. -
Key length is restricted to 172 characters, including the prefix.