Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250530) (c39b7370636)
Base Interface Reference

Base for cache objects. More...

Inheritance diagram for Base:
DB File Memcache Memcached Redis MySQL moodle_simplepie_file

Public Member Functions

 __construct ($location, $name, $type)
 Create a new cache object.
 
 load ()
 Retrieve the data saved to the cache.
 
 mtime ()
 Retrieve the last modified time for the cache.
 
 save ($data)
 Save data to the cache.
 
 touch ()
 Set the last modified time to the current time.
 
 unlink ()
 Remove the cache.
 

Public Attributes

string const TYPE_FEED = 'spc'
 Feed cache type.
 
string const TYPE_IMAGE = 'spi'
 Image cache type.
 

Detailed Description

Base for cache objects.

Classes to be used with {

See also
SimplePie::Cache::register()} are expected to implement this interface.

@subpackage Caching

Deprecated
since SimplePie 1.8.0, use "Psr::SimpleCache::CacheInterface" instead

Constructor & Destructor Documentation

◆ __construct()

Base::__construct ( $location,
$name,
$type )

Create a new cache object.

Parameters
string$locationLocation string (from SimplePie::$cache_location)
string$nameUnique ID for the cache
Base::TYPE_FEED | Base::TYPE_IMAGE$typeEither TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data

Implemented in File, Memcache, Memcached, MySQL, and Redis.

Member Function Documentation

◆ load()

Base::load ( )

Retrieve the data saved to the cache.

Return values
arrayData for SimplePie::$data

Implemented in File, Memcache, Memcached, MySQL, and Redis.

◆ mtime()

Base::mtime ( )

Retrieve the last modified time for the cache.

Return values
intTimestamp

Implemented in File, Memcache, Memcached, MySQL, and Redis.

◆ save()

Base::save ( $data)

Save data to the cache.

Parameters
array | SimplePie::SimplePie$dataData to store in the cache. If passed a SimplePie object, only cache the $data property
Return values
boolSuccessfulness

Implemented in File, Memcache, Memcached, MySQL, and Redis.

◆ touch()

Base::touch ( )

Set the last modified time to the current time.

Return values
boolSuccess status

Implemented in File, Memcache, Memcached, MySQL, and Redis.

◆ unlink()

Base::unlink ( )

Remove the cache.

Return values
boolSuccess status

Implemented in File, Memcache, Memcached, MySQL, and Redis.


The documentation for this interface was generated from the following file: