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 * @param Request $request A Request instance
32 * @return Response|null A Response instance, or null if no cache entry was found
34 public function lookup(Request $request);
37 * Writes a cache entry to the store for the given Request and Response.
39 * Existing entries are read and any that match the response are removed. This
40 * method calls write with the new list of cache entries.
42 * @param Request $request A Request instance
43 * @param Response $response A Response instance
45 * @return string The key under which the response is stored
47 public function write(Request $request, Response $response);
50 * Invalidates all cache entries that match the request.
52 * @param Request $request A Request instance
54 public function invalidate(Request $request);
57 * Locks the cache for a given Request.
59 * @param Request $request A Request instance
61 * @return bool|string true if the lock is acquired, the path to the current lock otherwise
63 public function lock(Request $request);
66 * Releases the lock for the given Request.
68 * @param Request $request A Request instance
70 * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise
72 public function unlock(Request $request);
75 * Returns whether or not a lock exists.
77 * @param Request $request A Request instance
79 * @return bool true if lock exists, false otherwise
81 public function isLocked(Request $request);
84 * Purges data for the given URL.
86 * @param string $url A URL
88 * @return bool true if the URL exists and has been purged, false otherwise
90 public function purge($url);
95 public function cleanup();