HttpCache\Store (Component\HttpKernel)

Symfony\Component\HttpKernel\HttpCache\Store

class Store implements StoreInterface

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

Methods

__construct(string $root)

Constructor.

cleanup()

Cleanups storage.

bool|string lock(Request $request)

Locks the cache for a given Request.

bool unlock(Request $request)

Releases the lock for the given Request.

bool isLocked(Request $request)

Returns whether or not a lock exists.

Response|null lookup(Request $request)

Locates a cached Response for the Request provided.

string write(Request $request, Response $response)

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

invalidate(Request $request)

Invalidates all cache entries that match the request.

bool purge(string $url)

Purges data for the given URL.

getPath($key)

Details

public __construct(string $root)

Constructor.

Parameters

string $root The path to the cache directory

Exceptions

RuntimeException

public cleanup()

Cleanups storage.

public bool|string lock(Request $request)

Locks the cache for a given Request.

Parameters

Request $request A Request instance

Return Value

bool|string true if the lock is acquired, the path to the current lock otherwise

public bool unlock(Request $request)

Releases the lock for the given Request.

Parameters

Request $request A Request instance

Return Value

bool False if the lock file does not exist or cannot be unlocked, true otherwise

public bool isLocked(Request $request)

Returns whether or not a lock exists.

Parameters

Request $request A Request instance

Return Value

bool true if lock exists, false otherwise

public Response|null lookup(Request $request)

Locates a cached Response for the Request provided.

Parameters

Request $request A Request instance

Return Value

Response|null A Response instance, or null if no cache entry was found

public string 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 $request A Request instance
Response $response A Response instance

Return Value

string The key under which the response is stored

Exceptions

RuntimeException

public invalidate(Request $request)

Invalidates all cache entries that match the request.

Parameters

Request $request A Request instance

Exceptions

RuntimeException

public bool purge(string $url)

Purges data for the given URL.

Parameters

string $url A URL

Return Value

bool true if the URL exists and has been purged, false otherwise

public getPath($key)

Parameters

$key

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/HttpKernel/HttpCache/Store.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部