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