Cache: ezcCacheStorageFileApcArray
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcCacheStorageFileApcArray
|
This class is a replacement for the
ezcCacheStorageFileArray class. Tries to serve data from a local APC cache if possible. [
source]
Parents
ezcCacheStorage
|
--ezcCacheStorageMemory
|
--ezcCacheStorageApc
|
--ezcCacheStorageFileApcArray
Inherited Constants
From
ezcCacheStorageApc:
Inherited Member Variables
From
ezcCacheStorageMemory:
From
ezcCacheStorage:
Method Summary
|
public ezcCacheStorageFileApcArray |
__construct(
$location, [$options = array()] )
Creates a new cache storage in the given location. The location in case of this storage class must a valid file system directory. |
|
protected int |
calcLifetime(
$filename, [$useApc = false] )
Calculates the lifetime remaining for a cache object. |
|
public void |
delete(
[$id = null], [$attributes = array()], [$search = false] )
Deletes the data associated with $id or $attributes from the cache. |
|
protected mixed |
fetchData(
$filename, [$useApc = false] )
Fetches the data from the cache. |
|
protected mixed |
fetchObject(
$filename )
Fetches the object from the cache. |
|
protected mixed |
prepareData(
$data, [$useApc = false] )
Wraps the data in order to be stored in APC ($useApc = true) or on the file system ($useApc = false). |
|
public mixed |
restore(
$id, [$attributes = array()], [$search = false] )
Restores the data from the cache. |
|
public string |
store(
$id, $data, [$attributes = array()] )
Stores data to the cache storage. |
|
protected void |
validateLocation(
)
Checks the path in the location property exists, and is read-/writable. It throws an exception if not. |
Inherited Methods
From
ezcCacheStorageApc :
From
ezcCacheStorageMemory :
From
ezcCacheStorage :
Methods
__construct
ezcCacheStorageFileApcArray __construct(
string
$location, [
$options = array()] )
Creates a new cache storage in the given location. The location in case of this storage class must a valid file system directory.
Options can contain the 'ttl' (Time-To-Live). This is per default set to 1 day. The option 'permissions' can be used to define the file permissions of created cache items.
Parameters
| Name |
Type |
Description |
$location |
string |
Path to the cache location. Must be a valid path |
$options |
array(string=>string) |
Options for the cache storage |
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
If you tried to set a non-existent option value. |
Redefinition of
calcLifetime
int calcLifetime(
string
$filename, [bool
$useApc = false] )
Calculates the lifetime remaining for a cache object.
If the TTL option is set to false, this method will always return 1 for existing items.
Parameters
| Name |
Type |
Description |
$filename |
string |
The file to calculate the remaining lifetime for |
$useApc |
bool |
Use APC or not |
Redefinition of
delete
void delete(
[string
$id = null], [array(string=>string)
$attributes = array()], [bool
$search = false] )
Deletes the data associated with $id or $attributes from the cache.
Parameters
| Name |
Type |
Description |
$id |
string |
The item ID to purge |
$attributes |
array(string=>string) |
Attributes describing the data to restore |
$search |
bool |
Whether to search for items if not found directly |
Throws
| Class | Description |
ezcBaseFilePermissionException |
If an already existsing cache file could not be unlinked. This exception means most likely that your cache directory has been corrupted by external influences (file permission change). |
Redefinition of
fetchData
mixed fetchData(
string
$filename, [bool
$useApc = false] )
Fetches the data from the cache.
Parameters
| Name |
Type |
Description |
$filename |
string |
The ID/filename from where to fetch the object |
$useApc |
bool |
Use APC or the file system |
Redefinition of
fetchObject
mixed fetchObject(
string
$filename )
Fetches the object from the cache.
Parameters
| Name |
Type |
Description |
$filename |
string |
The ID/filename from where to fetch the data |
prepareData
mixed prepareData(
mixed
$data, [bool
$useApc = false] )
Wraps the data in order to be stored in APC ($useApc = true) or on the file system ($useApc = false).
Parameters
| Name |
Type |
Description |
$data |
mixed |
Simple type or array |
$useApc |
bool |
Use APC or not |
Throws
| Class | Description |
ezcCacheInvalidDataException |
If the data submitted can not be handled by this storage (object, resource). |
Redefinition of
restore
mixed restore(
string
$id, [array(string=>string)
$attributes = array()], [bool
$search = false] )
Restores the data from the cache.
Parameters
| Name |
Type |
Description |
$id |
string |
The item ID to restore |
$attributes |
array(string=>string) |
Attributes describing the data to restore |
$search |
bool |
Whether to search for items if not found directly |
Redefinition of
store
string store(
string
$id, mixed
$data, [array(string=>string)
$attributes = array()] )
Stores data to the cache storage.
Parameters
| Name |
Type |
Description |
$id |
string |
Unique identifier |
$data |
mixed |
The data to store |
$attributes |
array(string=>string) |
Attributes describing the cached data |
Throws
| Class | Description |
ezcBaseFilePermissionException |
If the directory to store the cache file could not be created. This exception means most likely that your cache directory has been corrupted by external influences (file permission change). |
ezcBaseFileIoException |
If an error occured while writing the data to the cache. If this exception occurs, a serious error occured and your storage might be corruped (e.g. broken network connection, file system broken, ...). |
ezcCacheInvalidDataException |
If the data submitted can not be handled by the implementation of ezcCacheStorageFile. Most implementations can not handle objects and resources. |
ezcCacheApcException |
If the data could not be stored in APC. |
Redefinition of
validateLocation
void validateLocation(
)
Checks the path in the location property exists, and is read-/writable. It throws an exception if not.
Throws
| Class | Description |
ezcBaseFileNotFoundException |
If the storage location does not exist. This should usually not happen, since ezcCacheManager::createCache() already performs sanity checks for the cache location. In case this exception is thrown, your cache location has been corrupted after the cache was configured. |
ezcBaseFileNotFoundException |
If the storage location is not a directory. This should usually not happen, since ezcCacheManager::createCache() already performs sanity checks for the cache location. In case this exception is thrown, your cache location has been corrupted after the cache was configured. |
ezcBaseFilePermissionException |
If the storage location is not writeable. This should usually not happen, since ezcCacheManager::createCache() already performs sanity checks for the cache location. In case this exception is thrown, your cache location has been corrupted after the cache was configured. |
Redefinition of
Last updated: Mon, 11 May 2009