kernel/private/rest/classes/cache/object.php

Show: inherited
Table of Contents

File containing ezpRestCacheStorageClusterObject class

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Package
kernel  
Version
4.6.0  

\ezpRestCacheStorageClusterObject

Package: Default

Cache storage implementation for compatible objects (implementing ezcBaseExportable interface).

Will also work with arrays and scalar values (int, float, string, bool)

Parent(s)
\ezpRestCacheStorageCluster < \ezpRestCacheStorageFile < \ezcCacheStorageFile
Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
Version
4.6.0  

Properties

Propertyprotected\eZClusterFileHandlerInterface  $clusterCacheFile= ''
inherited

Cluster file handler instance for cache file

Inherited from: \ezpRestCacheStorageCluster::$$clusterCacheFile
Propertypublicbool  $isCacheEnabled= 'true'
inherited

Flag indicating if cache is enabled or not.

Inherited from: \ezpRestCacheStorageCluster::$$isCacheEnabled

This flag should be set by the cache caller. Default is true

Default valuetrueDetails
Type
bool
Inherited_from
\ezpRestCacheStorageCluster::$$isCacheEnabled  

Methods

methodpublic__construct( string $location, \array(string=>string) $options = array() ) : void
inherited

Creates a new cache storage for a given location through eZ Publish cluster mechanism Options can contain the 'ttl' ( Time-To-Life ). This is per default set to 1 day.

Inherited from: \ezpRestCacheStorageCluster::__construct()
Parameters
Name Type Description
$location string

Path to the cache location inside the cluster

$options \array(string=>string)

Options for the cache.

methodpublicabortCacheGeneration( ) : void
inherited

Aborts current cache generation Useful in case of a problem during generation of content (ie. exception)

Inherited from: \ezpRestCacheStorageCluster::abortCacheGeneration()
Throws
Exception Description
\ezpCacheClusterException
methodpublicclusterRetrieve( string $file, int $mtime, array $args ) : string
inherited

Retrieve callback for cluster processCache() method

Inherited from: \ezpRestCacheStorageCluster::clusterRetrieve()
Parameters
Name Type Description
$file string

Filepath

$mtime int

File modification time

$args array

Extra args passed to the cluster processCache() method

Returns
Type Description
string
methodpubliccountDataItems( string $id = null, \array(string=>string) $attributes = array() ) : int
inherited

Return the number of items in the cache matching a certain criteria.

Inherited from: \ezpRestCacheStorageCluster::countDataItems()

This method determines if cache data described by the given ID and/or attributes exists. It returns the number of cache data items found.

Parameters
Name Type Description
$id string

The item ID.

$attributes \array(string=>string)

Attributes that describe the item

Returns
Type Description
int The number of cache data items found matching the criteria
methodpublicdelete( string $id = null, \array(string=>string) $attributes = array(), bool $search = false ) : void
inherited

Delete data from the cache.

Inherited from: \ezpRestCacheStorageCluster::delete()

Purges the cached data for a given ID and or attributes. Using an ID purges only the cache data for just this ID.

Additional attributes provided will matched additionally. This can give you an immense speed improvement against just searching for ID ( see {@link ezcCacheStorage::restore()} ).

If you only provide attributes for deletion of cache data, all cache data matching these attributes will be purged.

Parameters
Name Type Description
$id string

The item ID.

$attributes \array(string=>string)

Attributes that describe the cached data.

$search bool

Whether to search for items if not found directly. Default is false.

methodprotectedfetchData( string $filename ) : mixed

Fetch data from the cache.

This method fetches the desired data from the file with $filename from disk. This implementation uses an include statement for fetching. The return value depends on the stored data and might either be an object implementing {@link ezcBaseExportable}, an array or a scalar value.

Parameters
Name Type Description
$filename string
Returns
Type Description
mixed
methodpublicgetRemainingLifetime( string $id, \array(string=>string) $attributes = array() ) : int
inherited

Returns the time ( in seconds ) that remains for a cache object, before it gets outdated. In case the cache object is already outdated or does not exist, this method returns 0.

Inherited from: \ezpRestCacheStorageCluster::getRemainingLifetime()
Parameters
Name Type Description
$id string

The item ID.

$attributes \array(string=>string)

Attributes that describe the

Returns
Type Description
int The remaining lifetime ( 0 if nonexists or outdated ).
Details
Access
public  
methodprotectedprepareData( mixed $data ) : string

Serialize the data for storing.

Serializes the given $data to a executable PHP code representation string. This works with objects implementing {@link ezcBaseExportable}, arrays and scalar values (int, bool, float, string). The return value is executable PHP code to be stored to disk. The data can be unserialized using the {@link fetchData()} method.

Parameters
Name Type Description
$data mixed
Returns
Type Description
string
Throws
Exception Description
\ezcCacheInvalidDataException if the $data can not be serialized (e.g. an object that does not implement ezcBaseExportable, a resource, ...).
methodpublicrestore( string $id, \array(string=>string) $attributes = array(), bool $search = false ) : mixed
inherited

Restore data from the cache.

Inherited from: \ezpRestCacheStorageCluster::restore()

Restores the data associated with the given cache and returns it. Please see {@link ezcCacheStorage::store()} for more detailed information of cachable datatypes.

During access to cached data the caches are automatically expired. This means, that the ezcCacheStorage object checks before returning the data if it's still actual. If the cache has expired, data will be deleted and false is returned.

You should always provide the attributes you assigned, although the cache storages must be able to find a cache ID even without them. BEWARE: Finding cache data only by ID can be much slower than finding it by ID and attributes.

Parameters
Name Type Description
$id string

The item ID.

$attributes \array(string=>string)

Attributes that describe the cached data.

$search bool

Whether to search for items if not found directly. Default is false.

Returns
Type Description
mixed The cached data on success, otherwise false.
methodpublicstore(  $id,  $data,  $attributes = array() ) : void
inherited

(non-PHPdoc)

Inherited from: \ezpRestCacheStorageCluster::store()
Parameters
Name Type Description
$id
$data
$attributes
Details
See
\lib/ezc/Cache/src/storage/ezcCacheStorageFile::store()  
Documentation was generated by DocBlox 0.18.1.