Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Memcached Class Reference

Caches data to memcached. More...

Inheritance diagram for Memcached:

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

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

Detailed Description

Caches data to memcached.

Registered for URLs with the "memcached" protocol

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

@subpackage Caching

Author
Paul L. McNeely @uses Memcached
Deprecated
since SimplePie 1.8.0, use implementation of "Psr::SimpleCache::CacheInterface" instead

Constructor & Destructor Documentation

◆ __construct()

Memcached::__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()

Memcached::load ( )

Retrieve the data saved to the cache.

Return values
arrayData for SimplePie\$data

◆ mtime()

Memcached::mtime ( )

Retrieve the last modified time for the cache.

Return values
intTimestamp

◆ save()

Memcached::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()

Memcached::touch ( )

Set the last modified time to the current time.

Return values
boolSuccess status

◆ unlink()

Memcached::unlink ( )

Remove the cache.

Return values
boolSuccess status

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