Q_Cache Class
Used to maintain arbitrary data in persistent cache storage
Item Index
Methods
- clear static
- connected static
- exists static
- fetchStore static
- get static
- ignore static
- init static
- set static
- setDuration static
- shutdownFunction static
Properties
Methods
clear
-
$key
-
[$prefix=false]
-
[$namespace=self::$namespace]
Clear Q_Cache entry
Parameters:
-
$key
String | TrueThe key of cache entry. Skip this to clear all the keys. Pass true to also clear the user files cache.
-
[$prefix=false]
Boolean optionalWhether to clear all keys for which $key is a prefix
-
[$namespace=self::$namespace]
String optionalThe namespace to use
Returns:
Whether an apc cache was fetched.
connected
()
Boolean
static
Check if Q_Cache is connected to some PHP cache engine (currently APC)
Returns:
Whether cache is currently connected
exists
-
$key
-
[$namespace=self::$namespace]
Check if a Q_Cache entry exists
Parameters:
-
$key
StringThe key of cache entry
-
[$namespace=self::$namespace]
String optionalThe namespace to use
Returns:
Whether it exists
fetchStore
-
[$namespace=self::$namespace]
-
[$fetched]
Fetches the cache store from APC. In either case, prepares self::$store[$namespace] to be used as an array.
Parameters:
-
[$namespace=self::$namespace]
String optionalThe namespace to use
-
[$fetched]
Boolean optionalIf passed, this is filled with whether the store was fetched
Returns:
A reference to the cache store, or to an empty array if nothing was fetched
get
-
$key
-
[$default=null]
-
[$namespace=self::$namespace]
Get Q_Cache entry
Parameters:
-
$key
StringThe key of cache entry
-
[$default=null]
Mixed optionalIn case the entry isn't there
-
[$namespace=self::$namespace]
String optionalThe namespace to use
Returns:
The value of Q_Cache entry, or null on failure
ignore
-
$setting
Can be used to ignore the cache for a while, to re-populate it
Parameters:
-
$setting
BooleanWhether to start or to stop ignoring the cache during Q_Cache::get
Returns:
Returns the old setting
init
()
static
set
-
$key
-
$value
-
[$namespace=self::$namespace]
Set Q_Cache entry
Parameters:
-
$key
StringThe key of cache entry
-
$value
MixedThe value to set in cache
-
[$namespace=self::$namespace]
String optionalThe namespace to use
Returns:
Whether cache was fetched (if not, it will attempt to be saved at script shutdown)
setDuration
-
$duration
-
[$namespace=self::$namespace]
Set the duration for a given cache store. The default is in Q/cache/duration config.
Parameters:
-
$duration
IntegerThe number of seconds to store until the cache under this namespace expires
-
[$namespace=self::$namespace]
String optionalThe namespace to use