lachlanarthur/psr16-wordpress-transients

Use WordPress transients as a PSR-16 cache.

1.1 2020-03-08 05:45 UTC

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 or false. This is because the WP transient API returns false for a cache miss, and the PSR-16 spec must return null for a cache miss.

  • Key length is restricted to 172 characters, including the prefix.