Stud.IP  5.4
StudipRedisCache Class Reference
Inheritance diagram for StudipRedisCache:
StudipCache

Public Member Functions

 __construct ($hostname, $port, string $auth='')
 
 getRedis ()
 
 expire ($arg)
 
 read ($arg)
 
 write ($name, $content, $expire=self::DEFAULT_EXPIRATION)
 
 flush ()
 
 __call ($method, $args)
 
 getStats ()
 

Static Public Member Functions

static getDisplayName ()
 
static getConfig ()
 

Additional Inherited Members

- Data Fields inherited from StudipCache
const DEFAULT_EXPIRATION = 12 * 60 * 60
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $hostname,
  $port,
string  $auth = '' 
)

Construct a cache instance.

Parameters
string$hostnameHostname of redis server
int$portPort of redis server
string$authOptional auth token/password

Member Function Documentation

◆ __call()

__call (   $method,
  $args 
)
Parameters
string$methodMethod to call
array$argsArguments to pass
Returns
false|mixed

◆ expire()

expire (   $arg)

Expire item from the cache.

Example:

expires foo

$cache->expire('foo');

Parameters
string$arga single key.

Implements StudipCache.

◆ flush()

flush ( )

Expire all items from the cache.

Implements StudipCache.

◆ getConfig()

static getConfig ( )
static

Return the Vue component name and props that handle configuration. The associative array is of the form [ 'component' => <Vue component="" name>="">, 'props' => <Properties for="" component>=""> ]

Returns
array

Implements StudipCache.

◆ getDisplayName()

static getDisplayName ( )
static
Returns
string A translateable display name for this cache class.

Implements StudipCache.

◆ getRedis()

getRedis ( )

Returns the instance of the redis server connection.

Returns
Redis instance

◆ getStats()

getStats ( )

Return statistics.

::getStats()

Returns
array|array[]

Implements StudipCache.

◆ read()

read (   $arg)

Retrieve item from the server.

Example:

reads foo

$foo = $cache->reads('foo');

Parameters
string$arga single key
Returns
mixed the previously stored data if an item with such a key exists on the server or FALSE on failure.

Implements StudipCache.

◆ write()

write (   $name,
  $content,
  $expire = self::DEFAULT_EXPIRATION 
)

Store data at the server.

Parameters
stringthe item's key.
stringthe item's content.
intthe item's expiry time in seconds. Defaults to 12h.
Returns
mixed returns TRUE on success or FALSE on failure.

Implements StudipCache.


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