4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * This code is partially based on the Rack-Cache library by Ryan Tomayko,
9 * which is released under the MIT license.
11 * For the full copyright and license information, please view the LICENSE
12 * file that was distributed with this source code.
15 namespace Symfony\Component\HttpKernel\HttpCache;
17 use Symfony\Component\HttpFoundation\Request;
18 use Symfony\Component\HttpFoundation\Response;
21 * Interface implemented by HTTP cache stores.
23 * @author Fabien Potencier <fabien@symfony.com>
25 interface StoreInterface
28 * Locates a cached Response for the Request provided.
30 * @return Response|null A Response instance, or null if no cache entry was found
32 public function lookup(Request $request);
35 * Writes a cache entry to the store for the given Request and Response.
37 * Existing entries are read and any that match the response are removed. This
38 * method calls write with the new list of cache entries.
40 * @return string The key under which the response is stored
42 public function write(Request $request, Response $response);
45 * Invalidates all cache entries that match the request.
47 public function invalidate(Request $request);
50 * Locks the cache for a given Request.
52 * @return bool|string true if the lock is acquired, the path to the current lock otherwise
54 public function lock(Request $request);
57 * Releases the lock for the given Request.
59 * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise
61 public function unlock(Request $request);
64 * Returns whether or not a lock exists.
66 * @return bool true if lock exists, false otherwise
68 public function isLocked(Request $request);
71 * Purges data for the given URL.
73 * @param string $url A URL
75 * @return bool true if the URL exists and has been purged, false otherwise
77 public function purge($url);
82 public function cleanup();