Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
Memcache Class Reference

Caches data to memcache. More...

Inheritance diagram for Memcache:

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.
 

Protected Attributes

Memcache $cache
 Memcache instance.
 
string $name
 Cache name.
 
array $options
 Options.
 

Detailed Description

Caches data to memcache.

Registered for URLs with the "memcache" protocol

For example, memcache://localhost:11211/?timeout=3600&prefix=sp_ will connect to memcache on localhost on port 11211. All tables will be prefixed with sp_ and data will expire after 3600 seconds

@subpackage Caching @uses Memcache

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

Constructor & Destructor Documentation

◆ __construct()

Memcache::__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

Member Function Documentation

◆ load()

Memcache::load ( )

Retrieve the data saved to the cache.

Return values
arrayData for SimplePie\$data

◆ mtime()

Memcache::mtime ( )

Retrieve the last modified time for the cache.

Return values
intTimestamp

◆ save()

Memcache::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

◆ touch()

Memcache::touch ( )

Set the last modified time to the current time.

Return values
boolSuccess status

◆ unlink()

Memcache::unlink ( )

Remove the cache.

Return values
boolSuccess status

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