Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
7 *
|
Chris@0
|
8 * This code is partially based on the Rack-Cache library by Ryan Tomayko,
|
Chris@0
|
9 * which is released under the MIT license.
|
Chris@0
|
10 *
|
Chris@0
|
11 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
12 * file that was distributed with this source code.
|
Chris@0
|
13 */
|
Chris@0
|
14
|
Chris@0
|
15 namespace Symfony\Component\HttpKernel\HttpCache;
|
Chris@0
|
16
|
Chris@0
|
17 use Symfony\Component\HttpFoundation\Request;
|
Chris@0
|
18 use Symfony\Component\HttpFoundation\Response;
|
Chris@0
|
19
|
Chris@0
|
20 /**
|
Chris@0
|
21 * Interface implemented by HTTP cache stores.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @author Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
24 */
|
Chris@0
|
25 interface StoreInterface
|
Chris@0
|
26 {
|
Chris@0
|
27 /**
|
Chris@0
|
28 * Locates a cached Response for the Request provided.
|
Chris@0
|
29 *
|
Chris@0
|
30 * @return Response|null A Response instance, or null if no cache entry was found
|
Chris@0
|
31 */
|
Chris@0
|
32 public function lookup(Request $request);
|
Chris@0
|
33
|
Chris@0
|
34 /**
|
Chris@0
|
35 * Writes a cache entry to the store for the given Request and Response.
|
Chris@0
|
36 *
|
Chris@0
|
37 * Existing entries are read and any that match the response are removed. This
|
Chris@0
|
38 * method calls write with the new list of cache entries.
|
Chris@0
|
39 *
|
Chris@0
|
40 * @return string The key under which the response is stored
|
Chris@0
|
41 */
|
Chris@0
|
42 public function write(Request $request, Response $response);
|
Chris@0
|
43
|
Chris@0
|
44 /**
|
Chris@0
|
45 * Invalidates all cache entries that match the request.
|
Chris@0
|
46 */
|
Chris@0
|
47 public function invalidate(Request $request);
|
Chris@0
|
48
|
Chris@0
|
49 /**
|
Chris@0
|
50 * Locks the cache for a given Request.
|
Chris@0
|
51 *
|
Chris@0
|
52 * @return bool|string true if the lock is acquired, the path to the current lock otherwise
|
Chris@0
|
53 */
|
Chris@0
|
54 public function lock(Request $request);
|
Chris@0
|
55
|
Chris@0
|
56 /**
|
Chris@0
|
57 * Releases the lock for the given Request.
|
Chris@0
|
58 *
|
Chris@0
|
59 * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise
|
Chris@0
|
60 */
|
Chris@0
|
61 public function unlock(Request $request);
|
Chris@0
|
62
|
Chris@0
|
63 /**
|
Chris@0
|
64 * Returns whether or not a lock exists.
|
Chris@0
|
65 *
|
Chris@0
|
66 * @return bool true if lock exists, false otherwise
|
Chris@0
|
67 */
|
Chris@0
|
68 public function isLocked(Request $request);
|
Chris@0
|
69
|
Chris@0
|
70 /**
|
Chris@0
|
71 * Purges data for the given URL.
|
Chris@0
|
72 *
|
Chris@0
|
73 * @param string $url A URL
|
Chris@0
|
74 *
|
Chris@0
|
75 * @return bool true if the URL exists and has been purged, false otherwise
|
Chris@0
|
76 */
|
Chris@0
|
77 public function purge($url);
|
Chris@0
|
78
|
Chris@0
|
79 /**
|
Chris@0
|
80 * Cleanups storage.
|
Chris@0
|
81 */
|
Chris@0
|
82 public function cleanup();
|
Chris@0
|
83 }
|