|
Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
|
Adapter for deprecated SimplePie::Cache::Base implementations. More...
Public Member Functions | |
| __construct (Base $cache) | |
| delete_data (string $key) | |
| Delete an item from the cache by its unique key. | |
| get_data (string $key, $default=null) | |
| Fetches a value from the cache. | |
| set_data (string $key, array $value, ?int $ttl=null) | |
| Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time. | |
Adapter for deprecated SimplePie::Cache::Base implementations.
@subpackage Caching
| BaseDataCache::delete_data | ( | string | $key | ) |
Delete an item from the cache by its unique key.
Equivalent to Psr\SimpleCache\CacheInterface\delete() public function delete(string $key): bool;
| string | $key | The unique cache key of the item to delete. |
| bool | True if the item was successfully removed. False if there was an error. |
| InvalidArgumentException | MUST be thrown if the $key string is not a legal value. |
Implements DataCache.
| BaseDataCache::get_data | ( | string | $key, |
| $default = null ) |
Fetches a value from the cache.
Equivalent to Psr\SimpleCache\CacheInterface\get() public function get(string $key, mixed $default = null): mixed;
| string | $key | The unique key of this item in the cache. |
| mixed | $default | Default value to return if the key does not exist. |
| array|mixed | The value of the item from the cache, or $default in case of cache miss. |
| InvalidArgumentException | MUST be thrown if the $key string is not a legal value. |
Implements DataCache.
| BaseDataCache::set_data | ( | string | $key, |
| array | $value, | ||
| ?int | $ttl = null ) |
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
Equivalent to Psr\SimpleCache\CacheInterface\set() public function set(string $key, mixed $value, null|int|DateInterval $ttl = null): bool;
| string | $key | The key of the item to store. |
| array | $value | The value of the item to store, must be serializable. |
| null | int | $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. |
| bool | True on success and false on failure. |
| InvalidArgumentException | MUST be thrown if the $key string is not a legal value. |
Implements DataCache.