API - XOOPS 2.5.11 Beta 2
By monxoops.fr
Cache Class Reference
Inheritance diagram for Cache:
Collaboration diagram for Cache:

Public Member Functions

 init ()
 
 write ($key, $value, $ttl=null)
 
 read ($key, $default=false)
 
 delete ($key)
 
 cacheRead ($key, $regenFunction, $ttl=null, $args=null)
 
- Public Member Functions inherited from AbstractHelper
 __construct ($dirname=null)
 
 init ()
 
 dirname ()
 
 setDebug ($bool=true)
 
 addLog ($log)
 

Protected Member Functions

 prefix ($name)
 
- Protected Member Functions inherited from AbstractHelper
 serializeForHelperLog ($value)
 

Protected Attributes

 $prefix
 
 $cache
 
- Protected Attributes inherited from AbstractHelper
 $dirname
 
 $module
 
 $debug
 

Member Function Documentation

◆ cacheRead()

cacheRead (   $key,
  $regenFunction,
  $ttl = null,
  $args = null 
)

cache block wrapper

If the cache read for $key is a miss, call the $regenFunction to update it.

Parameters
string$keyIdentifier for the cache item
callable$regenFunctionfunction to generate cached content
int | null$ttltime to live, number of seconds as integer or null for default
mixed$argsvariable argument list for $regenFunction
Returns
mixed
Here is the call graph for this function:

◆ delete()

delete (   $key)

Delete a key from the cache

Parameters
string$keyIdentifier for the data
Returns
void
Here is the call graph for this function:

◆ init()

init ( )

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

Returns
void

Reimplemented from AbstractHelper.

Here is the call graph for this function:

◆ prefix()

prefix (   $name)
protected

Add our module prefix to a name

Parameters
string$namename to prefix
Returns
string module prefixed name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

read (   $key,
  $default = false 
)

Read value for a key from the cache

Parameters
string$keyIdentifier for the data
mixed$defaultdefault value to return if config $key is not set
Returns
mixed value if key was set, false not set or expired
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write()

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 | null$ttlTime to live in seconds
Returns
bool True if the data was successfully cached, false on failure
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ $cache

$cache
protected

◆ $prefix

$prefix
protected

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