Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

SimplePie A PHP-Based RSS and Atom Feed Framework. Takes the hard work out of managing a complete RSS/Atom solution.

Author: Ryan Parman
Author: Sam Sneddon
Author: Ryan McCue
Copyright: 2004-2022 Ryan Parman, Sam Sneddon, Ryan McCue
License: http://www.opensource.org/licenses/bsd-license.php BSD License
File Size: 120 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

DataCache:: (3 methods):
  get_data()
  set_data()
  delete_data()


Interface: DataCache  - X-Ref

Subset of PSR-16 Cache client for caching data arrays

Only get(), set() and delete() methods are used,
but not has(), getMultiple(), setMultiple() or deleteMultiple().

The methods names must be different, but should be compatible to the
methods of \Psr\SimpleCache\CacheInterface.

get_data(string $key, $default = null)   X-Ref
Fetches a value from the cache.

Equivalent to \Psr\SimpleCache\CacheInterface::get()
<code>
public function get(string $key, mixed $default = null): mixed;
</code>

param: string   $key     The unique key of this item in the cache.
param: mixed    $default Default value to return if the key does not exist.
return: array|mixed The value of the item from the cache, or $default in case of cache miss.

set_data(string $key, array $value, ?int $ttl = null)   X-Ref
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.

Equivalent to \Psr\SimpleCache\CacheInterface::set()
<code>
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool;
</code>

param: string   $key   The key of the item to store.
param: array    $value The value of the item to store, must be serializable.
param: null|int $ttl   Optional. The TTL value of this item. If no value is sent and
return: bool True on success and false on failure.

delete_data(string $key)   X-Ref
Delete an item from the cache by its unique key.

Equivalent to \Psr\SimpleCache\CacheInterface::delete()
<code>
public function delete(string $key): bool;
</code>

param: string $key The unique cache key of the item to delete.
return: bool True if the item was successfully removed. False if there was an error.