Download the PHP package alleyinteractive/wp-psr16 without Composer
On this page you can find all versions of the php package alleyinteractive/wp-psr16. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alleyinteractive/wp-psr16
More information about alleyinteractive/wp-psr16
Files in alleyinteractive/wp-psr16
Package wp-psr16
Short Description PSR-16 implementations for WordPress that cache data in the object cache, as transients, as options, and as object metadata.
License GPL-2.0-or-later
Homepage https://github.com/alleyinteractive/wp-psr16
Informations about the package wp-psr16
PSR-16 Implementations for WordPress
This library provides PSR-16 implementations for WordPress projects. It includes adapters for caching data in the object cache, as transients, as options, and as post, term, or other object metadata.
Installation
Install the latest version with:
Basic usage
All the adapters in this library implement the \Psr\SimpleCache\CacheInterface
interface and have no other public API apart from their static constructors.
Implementation details
WordPress returns scalar values in the option and metadata database tables as strings, which is incompatible with PSR-16's requirement that data be returned from the cache "exactly as passed [including] the variable type."
This library works around the default behavior of the database by serializing and unserializing values when they are saved to and retrieved from storage, which has some side effects:
- Cached items are stored in a custom array structure that includes the serialized value.
- Cache keys are stored with a prefix to avoid giving the impression that the cache key as passed to the adapter can be used to retrieve the original value using WordPress APIs directly.
- The custom array structure includes the item's expiration time, which allows option and metadata adapters to support TTLs.
The \Alley\WP\SimpleCache\PSR16_Compliant
decorator class is responsible for ensuring PSR-16 compatibility with respect to data types, expiration times, legal cache keys, and other requirements of the specification. You are free to use this decorator with your own cache adapters or with those of another library.
Limitations
- The transient, option, and metadata adapters do not support the
clear()
method. - The transient, option, and metadata adapters do not support saving binary data. Consult with the provider of your persistent object cache drop-in to determine whether it supports saving binary data.
- The metadata adapter bypasses type-specific functions like
get_post_meta()
in favor of underlying functions likeget_metadata()
for compatibility with other metadata functions likemetadata_exists()
.
About
License
Maintainers
All versions of wp-psr16 with dependencies
alleyinteractive/composer-wordpress-autoloader Version ^1.0
psr/simple-cache Version ^2.0 || ^3.0
symfony/clock Version ^6.4