|
Prismic.io PHP kit
3.0.0
|
Public Member Functions | |
| has ($key) | |
| get ($key) | |
| set ($key, $value, $ttl=0) | |
| delete ($key) | |
| clear () | |
This is the interface you're supposed to implement if you want to use your own caching strategy with the kit.
The way it works is pretty simple: implement the methods with your implementation, and pass an instance of your class as the $cache parameter in your Prismic::get call.
When writing your implementation be sure to check if your cache backend has a maximum key length. If so you will need to perform an operation on the key passed to the interface methods to limit the length, such as hashing it, since there is no guarantee that the passed keys will be any particular length.
Two implementations are included in the PHP kit out-of-the-box: ApcCache (which works with APC) and NoCache (which doesn't cache).
| Prismic\Cache\CacheInterface::clear | ( | ) |
Clears the whole cache
Implemented in Prismic\Cache\ApcCache, and Prismic\Cache\NoCache.
| Prismic\Cache\CacheInterface::delete | ( | $key | ) |
Deletes a cache entry, from its key
| string | $key | the key of the cache entry |
Implemented in Prismic\Cache\ApcCache, and Prismic\Cache\NoCache.
| Prismic\Cache\CacheInterface::get | ( | $key | ) |
Returns the value of a cache entry from its key
| string | $key | the key of the cache entry |
Implemented in Prismic\Cache\NoCache, and Prismic\Cache\ApcCache.
| Prismic\Cache\CacheInterface::has | ( | $key | ) |
Tests whether the cache has a value for a particular key
| string | $key | the key of the cache entry |
Implemented in Prismic\Cache\NoCache, and Prismic\Cache\ApcCache.
| Prismic\Cache\CacheInterface::set | ( | $key, | |
| $value, | |||
$ttl = 0 |
|||
| ) |
Stores a new cache entry
| string | $key | the key of the cache entry |
| \stdClass | $value | the value of the entry |
| int | $ttl | the time (in seconds) until this cache entry expires |
Implemented in Prismic\Cache\ApcCache, and Prismic\Cache\NoCache.
1.8.12