XOOPS  2.6.0
Xmf\Module\Cache Class Reference
Inheritance diagram for Xmf\Module\Cache:
Inheritance graph

Public Member Functions

 cacheRead ($cacheKey, $regenFunction, $ttl=null, $args=null)
 
 clear ()
 
 delete ($key)
 
 init ()
 
 read ($key)
 
 write ($key, $value, $ttl=null)
 
- Public Member Functions inherited from Xmf\Module\Helper\AbstractHelper
 __construct ($module=null)
 
 addLog ($log)
 
 init ()
 
 setDebug ($bool=true)
 

Protected Attributes

 $cache
 
 $prefix
 
- Protected Attributes inherited from Xmf\Module\Helper\AbstractHelper
 $debug
 
 $module
 

Private Member Functions

 prefix ($name)
 

Detailed Description

Definition at line 32 of file Cache.php.

Member Function Documentation

Xmf\Module\Cache::cacheRead (   $cacheKey,
  $regenFunction,
  $ttl = null,
  $args = null 
)

cache block wrapper

If the cache read for $key is a miss, call the $regenFunction to update it. With the PRECOMPUTE strategy, it will trigger a miss on a read on one caller before the cache expires, so it will be done in advance.

Parameters
string|string[]$cacheKey Identifier for the cache item
callable$regenFunctionfunction to generate cached content
int | DateTime | null$ttltime to live, number ofseconds as integer, DateTime to expire at a specific time, or null for default
mixed...$args variable argument list for $regenFunction
Returns
mixed

Definition at line 130 of file Cache.php.

References Xmf\Module\Cache\prefix().

Here is the call graph for this function:

Xmf\Module\Cache::clear ( )

clear all keys and data from the module's cache. This will do a hierarchical delete on our module specific prefix.

Returns
boolean True if the cache was successfully cleared, false otherwise

Definition at line 141 of file Cache.php.

Xmf\Module\Cache::delete (   $key)

Delete a key from the cache

Parameters
string$keyIdentifier for the data
Returns
void

Definition at line 109 of file Cache.php.

References Xmf\Module\Cache\prefix().

Here is the call graph for this function:

Xmf\Module\Cache::init ( )

Initialize parent::__constuct calls this after verifying module object.

Returns
void

Definition at line 49 of file Cache.php.

References Xoops\getInstance(), and Xmf\Module\Cache\prefix().

Here is the call graph for this function:

Xmf\Module\Cache::prefix (   $name)
private

Add our module prefix to a name

Parameters
string$namename to prefix
Returns
string[] module prefixed name

Definition at line 62 of file Cache.php.

References $name, and Xmf\Module\Cache\$prefix.

Referenced by Xmf\Module\Cache\cacheRead(), Xmf\Module\Cache\delete(), Xmf\Module\Cache\init(), Xmf\Module\Cache\read(), and Xmf\Module\Cache\write().

Here is the caller graph for this function:

Xmf\Module\Cache::read (   $key)

Read value for a key from the cache

Parameters
string$keyIdentifier for the data
Returns
mixed value if key was set, false not set or expired

Definition at line 97 of file Cache.php.

References Xmf\Module\Cache\prefix().

Here is the call graph for this function:

Xmf\Module\Cache::write (   $key,
  $value,
  $ttl = null 
)

Write a value for a key to the cache

Parameters
string$keyIdentifier for the data
mixed$valueData to be cached - anything except a resource
int | DateTime | null$ttlTime to live, integer for ttl in seconds, DateTime object to expire at a specific time, or null for
Returns
bool True if the data was successfully cached, false on failure

Definition at line 85 of file Cache.php.

References Xmf\Module\Cache\prefix().

Here is the call graph for this function:

Member Data Documentation

Xmf\Module\Cache::$cache
protected

Definition at line 42 of file Cache.php.

Xmf\Module\Cache::$prefix
protected

Definition at line 37 of file Cache.php.

Referenced by Xmf\Module\Cache\prefix().


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