Methods summary
public
|
#
__construct( )
XoopsCache::__construct()
XoopsCache::__construct()
|
public static
object
|
#
getInstance( )
Returns a singleton instance
Returns a singleton instance
Returns
object
|
public
array
|
#
config( string|array $name = 'default', array $settings = array() )
Set the cache configuration to use
Set the cache configuration to use
Parameters
- $name
- Name of the configuration
- $settings
- Optional associative array of settings passed to the engine
Returns
array (engine, settings) on success, false on failure
|
public
boolean
|
#
engine( string $name = 'file', array $settings = array() )
Set the cache engine to use or modify settings for one instance
Set the cache engine to use or modify settings for one instance
Parameters
- $name
- Name of the engine (without 'Engine')
- $settings
- Optional associative array of settings passed to the engine
Returns
boolean True on success, false on failure
|
public
|
#
gc( )
Garbage collection
Permanently remove all expired and deleted data
|
public static
boolean
|
#
write( string $key, mixed $value, mixed $duration = null )
Write data for key into cache
Write data for key into cache
Parameters
- $key
- Identifier for the data
- $value
- Data to be cached - anything except a resource
- $duration
Optional - string configuration name OR how long to cache the data, either in seconds or a
string that can be parsed by the strtotime() function OR array('config' => 'default', 'duration' => '3600')
Returns
boolean True if the data was successfully cached, false on failure
|
public static
mixed
|
#
read( string $key, string|array $config = null )
Read a key from the cache
Read a key from the cache
Parameters
- $key
- Identifier for the data
- $config
- name of the configuration to use
Returns
mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
|
public static
boolean
|
#
delete( string $key, string $config = null )
Delete a key from the cache
Delete a key from the cache
Parameters
- $key
- Identifier for the data
- $config
- name of the configuration to use
Returns
boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed
|
public
boolean
|
#
clear( boolean $check = false, string $config = null )
Delete all keys from the cache
Delete all keys from the cache
Parameters
- $check
- if true will check expiration, otherwise delete all
- $config
- name of the configuration to use
Returns
boolean True if the cache was successfully cleared, false otherwise
|
public
boolean
|
#
isInitialized( string $engine = null )
Check if Cache has initialized a working storage engine
Check if Cache has initialized a working storage engine
Parameters
- $engine
- Name of the engine
Returns
boolean
|
public
array
|
#
settings( string $engine = null )
Return the settings for current cache engine
Return the settings for current cache engine
Parameters
- $engine
- Name of the engine
Returns
array list of settings for this engine
|
public
mixed
|
#
key( string $key )
generates a safe key
Parameters
Returns
mixed string $key or false
|