ApcCache
in package
implements
Cache
The APC cache class to use APC or APCu features to cache data.
This class is useful for perishable data. So, it requires the APC or APCu lib to be installed on the server. Look for php-apc package for Linux. http://php.net/manual/en/book.apc.php
Table of Contents
Interfaces
- Cache
- The interface to use to define a cache class.
Constants
- VERSION = 1
Properties
- $class : string|null
- The class of the cache
- $information : array<string|int, mixed>|null
- $key : string
- the key
- $name : string
- The name of the cache
- $supportsApc : bool
- Is APC Available ?
- $supportsApcu : bool
- Is APCu Available ?
- $ttl : int|null
- The time to live
Methods
- __construct() : mixed
- Constructor
- clear() : bool
- Clear the cache
- clearAll() : bool
- Clear all
- get() : bool
- Get the cache for the given parameters This method uses the apc_fetch() function.
- getClass() : string|null
- Class of the cache
- getHits() : int
- Get hit count.
- getInformation() : array<string|int, mixed>
- getName() : string
- Name of the cache's class
- getSize() : int
- Get size in bytes. 0 if none.
- hasSupport() : bool
- isSupportingApc() : bool
- isSupportingApcu() : bool
- list() : array<string|int, static>
- List all APC Caches
- set() : bool
- Set the cache for the given parameters This method uses the apc_store() function.
- setInformation() : static
Constants
VERSION
public
mixed
VERSION
= 1
Properties
$class
The class of the cache
protected
string|null
$class
Class of cache or null if not Orpheus cache
$information
protected
array<string|int, mixed>|null
$information
= null
$key
the key
protected
string
$key
$name
The name of the cache
protected
string
$name
$supportsApc
Is APC Available ?
protected
static bool
$supportsApc
= null
$supportsApcu
Is APCu Available ?
protected
static bool
$supportsApcu
= null
$ttl
The time to live
protected
int|null
$ttl
Methods
__construct()
Constructor
public
__construct(string|null $class, string $name[, int|null $ttl = null ][, bool $global = false ]) : mixed
Parameters
- $class : string|null
- $name : string
- $ttl : int|null = null
- $global : bool = false
clear()
Clear the cache
public
clear() : bool
Return values
bool —True in case of success
This method uses the apc_delete() function.
clearAll()
Clear all
public
static clearAll() : bool
Return values
boolget()
Get the cache for the given parameters This method uses the apc_fetch() function.
public
get(mixed &$cached) : bool
The data type is preserved, even for objects.
Parameters
- $cached : mixed
-
The output to get the cache
Return values
bool —True if cache has been retrieved
getClass()
Class of the cache
public
getClass() : string|null
Return values
string|nullgetHits()
Get hit count.
public
getHits() : int
Tags
Return values
intgetInformation()
public
getInformation() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getName()
Name of the cache's class
public
getName() : string
Return values
stringgetSize()
Get size in bytes. 0 if none.
public
getSize() : int
Tags
Return values
inthasSupport()
public
static hasSupport() : bool
Return values
boolisSupportingApc()
public
static isSupportingApc() : bool
Return values
boolisSupportingApcu()
public
static isSupportingApcu() : bool
Return values
boollist()
List all APC Caches
public
static list() : array<string|int, static>
Tags
Return values
array<string|int, static>set()
Set the cache for the given parameters This method uses the apc_store() function.
public
set(mixed $data) : bool
Parameters
- $data : mixed
-
The data to put in the cache
Return values
bool —True if cache has been saved
setInformation()
protected
setInformation(array<string|int, mixed> $information) : static
Parameters
- $information : array<string|int, mixed>