Download the PHP package soupmix/cache-base without Composer
On this page you can find all versions of the php package soupmix/cache-base. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download soupmix/cache-base
More information about soupmix/cache-base
Files in soupmix/cache-base
Package cache-base
Short Description Provides framework agnostic implementation of PSR-16 Simple Cache Interface
License MIT
Homepage https://github.com/soupmix/cache-base
Informations about the package cache-base
Soupmix Cache API
Soupmix Cache provides framework agnostic implementation of PSR-16 Simple Cache Interface.
1. Install and Connect to Service
It's recommended that you use Composer to install Soupmix Cache Adaptors.
1.1 Redis
Source Code
Installation
Connect to Redis (single instance) service
1.2 Memcached
Source Code
Installation
Connect to Memcached service
1.3 APCu
Source Code
Installation
Usage
2. Persist data in the cache, uniquely referenced by a key with an optional expiration TTL time.
@param string $key: The key of the item to store
@param mixed $value: The value of the item to store
@param null|integer|DateInterval $ttl: Optional. The TTL value of this item. If no value is sent and the driver supports TTL then the library may set a default value for it or let the driver take care of that. Predefined DataIntervals: TTL_MINUTE, TTL_HOUR, TTL_DAY.
@return bool True on success and false on failure
3. Determine whether an item is present in the cache.
@param string $key: The unique cache key of the item to delete
@return bool True on success and false on failure
4. Fetch a value from the cache.
@param string $key: The unique key of this item in the cache @return mixed The value of the item from the cache, or null in case of cache miss
5. Delete an item from the cache by its unique key
@param string $key: The unique cache key of the item to delete
@return bool True on success and false on failure
6. Persisting a set of key => value pairs in the cache, with an optional TTL.
@param array|Traversable $items: An array of key => value pairs for a multiple-set operation.
@param null|integer|DateInterval $ttl: Optional. The amount of seconds from the current time that the item will exist in the cache for. If this is null then the cache backend will fall back to its own default behaviour.
@return bool True on success and false on failure
7. Obtain multiple cache items by their unique keys.
@param array|Traversable $keys: A list of keys that can obtained in a single operation.
@return array An array of key => value pairs. Cache keys that do not exist or are stale will have a value of null.
8. Delete multiple cache items in a single operation.
@param array|Traversable $keys: The array of string-based keys to be deleted
@return bool True on success and false on failure
9. Increment a value atomically in the cache by its step value, which defaults to 1.
@param string $key: The cache item key
@param integer $step: The value to increment by, defaulting to 1
@return int|bool The new value on success and false on failure
Important Note:
Memcached does not increments the keys that's not been set before. For Memcached you must set key with the default value.
10. Decrement a value atomically in the cache by its step value, which defaults to 1
@param string $key: The cache item key
@param integer $step: The value to decrement by, defaulting to 1
Important Note 1:
Memcached does not decrements the keys that's not been set before. For Memcached you must set key with the default value.
Important Note 2:
Memcached does not decrements to negative values and stops at zero where Redis can decrement to negative values and goes setting -1,-2, etc...
11. Wipe clean the entire cache's keys (Flush)
@return bool True on success and false on failure