eZPublishCommunityProject  2012.12
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store Class Reference

Store implements all the logic for storing cache metadata (Request and Response headers). More...

+ Inheritance diagram for eZ\Publish\Core\MVC\Symfony\Cache\Http\Store:
+ Collaboration diagram for eZ\Publish\Core\MVC\Symfony\Cache\Http\Store:

Public Member Functions

 __construct ($root)
 Constructor. More...
 
 cleanup ()
 Cleanups storage. More...
 
 getPath ($key)
 
 invalidate (Request $request)
 Invalidates all cache entries that match the request. More...
 
 lock (Request $request)
 Locks the cache for a given Request. More...
 
 lookup (Request $request)
 Locates a cached Response for the Request provided. More...
 
 purge ($url)
 Purges data for the given URL. More...
 
 unlock (Request $request)
 Releases the lock for the given Request. More...
 
 write (Request $request, Response $response)
 Writes a cache entry to the store for the given Request and Response. More...
 

Protected Member Functions

 generateContentDigest (Response $response)
 Returns content digest for $response. More...
 

Protected Attributes

 $root
 

Private Member Functions

 getCacheKey (Request $request)
 Returns a cache key for the given Request. More...
 
 getMetadata ($key)
 Gets all data associated with the given key. More...
 
 load ($key)
 Loads data for the given key. More...
 
 persistRequest (Request $request)
 Persists the Request HTTP headers. More...
 
 persistResponse (Response $response)
 Persists the Response HTTP headers. More...
 
 requestsMatch ($vary, $env1, $env2)
 Determines whether two Request HTTP header sets are non-varying based on the vary response header value provided. More...
 
 restoreResponse ($headers, $body=null)
 Restores a Response from the HTTP headers and body. More...
 
 save ($key, $data)
 Save data for the given key. More...
 

Private Attributes

 $keyCache
 
 $locks
 

Detailed Description

Store implements all the logic for storing cache metadata (Request and Response headers).

This class is a enhanced version of Symfony :

  • Changes $root visibility from private to protected
  • Adds generateContentDigest() protected method allowing some control on content digest generation
Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Constructor & Destructor Documentation

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::__construct (   $root)

Constructor.

Parameters
string$rootThe path to the cache directory

Member Function Documentation

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::cleanup ( )

Cleanups storage.

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::generateContentDigest ( Response  $response)
protected

Returns content digest for $response.

Parameters
Response$response
Returns
string

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\write().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::getCacheKey ( Request  $request)
private
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::getMetadata (   $key)
private

Gets all data associated with the given key.

Use this method only if you know what you are doing.

Parameters
string$keyThe store key
Returns
array An array of data associated with the key

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\invalidate(), eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\lookup(), and eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\write().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::invalidate ( Request  $request)

Invalidates all cache entries that match the request.

Parameters
Request$requestA Request instance
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::load (   $key)
private

Loads data for the given key.

Parameters
string$keyThe store key
Returns
string The data associated with the key

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\getMetadata().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::lock ( Request  $request)

Locks the cache for a given Request.

Parameters
Request$requestA Request instance
Returns
Boolean|string true if the lock is acquired, the path to the current lock otherwise
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::lookup ( Request  $request)

Locates a cached Response for the Request provided.

Parameters
Request$requestA Request instance
Returns
Response|null A Response instance, or null if no cache entry was found
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::persistRequest ( Request  $request)
private

Persists the Request HTTP headers.

Parameters
Request$requestA Request instance
Returns
array An array of HTTP headers

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\write().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::persistResponse ( Response  $response)
private

Persists the Response HTTP headers.

Parameters
Response$responseA Response instance
Returns
array An array of HTTP headers

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\invalidate(), and eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\write().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::purge (   $url)

Purges data for the given URL.

Parameters
string$urlA URL
Returns
Boolean true if the URL exists and has been purged, false otherwise

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\LocationAwareStore\purgeByRequest().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::requestsMatch (   $vary,
  $env1,
  $env2 
)
private

Determines whether two Request HTTP header sets are non-varying based on the vary response header value provided.

Parameters
string$varyA Response vary header
array$env1A Request HTTP header array
array$env2A Request HTTP header array
Returns
Boolean true if the the two environments match, false otherwise

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\lookup(), and eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\write().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::restoreResponse (   $headers,
  $body = null 
)
private

Restores a Response from the HTTP headers and body.

Parameters
array$headersAn array of HTTP headers for the Response
string$bodyThe Response body

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\invalidate(), and eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\lookup().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::save (   $key,
  $data 
)
private

Save data for the given key.

Parameters
string$keyThe store key
string$dataThe data to store

Referenced by eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\invalidate(), and eZ\Publish\Core\MVC\Symfony\Cache\Http\Store\write().

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::unlock ( Request  $request)

Releases the lock for the given Request.

Parameters
Request$requestA Request instance
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::write ( Request  $request,
Response  $response 
)

Writes a cache entry to the store for the given Request and Response.

Existing entries are read and any that match the response are removed. This method calls write with the new list of cache entries.

Parameters
Request$requestA Request instance
Response$responseA Response instance
Returns
string The key under which the response is stored

Member Data Documentation

eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::$keyCache
private
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::$locks
private
eZ\Publish\Core\MVC\Symfony\Cache\Http\Store::$root
protected

The documentation for this class was generated from the following file: