Chris@0: Chris@0: * Chris@0: * This code is partially based on the Rack-Cache library by Ryan Tomayko, Chris@0: * which is released under the MIT license. Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\HttpKernel\HttpCache; Chris@0: Chris@0: use Symfony\Component\HttpFoundation\Request; Chris@0: use Symfony\Component\HttpFoundation\Response; Chris@0: Chris@0: /** Chris@0: * Interface implemented by HTTP cache stores. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: interface StoreInterface Chris@0: { Chris@0: /** Chris@0: * Locates a cached Response for the Request provided. Chris@0: * Chris@0: * @return Response|null A Response instance, or null if no cache entry was found Chris@0: */ Chris@0: public function lookup(Request $request); Chris@0: Chris@0: /** Chris@0: * Writes a cache entry to the store for the given Request and Response. Chris@0: * Chris@0: * Existing entries are read and any that match the response are removed. This Chris@0: * method calls write with the new list of cache entries. Chris@0: * Chris@0: * @return string The key under which the response is stored Chris@0: */ Chris@0: public function write(Request $request, Response $response); Chris@0: Chris@0: /** Chris@0: * Invalidates all cache entries that match the request. Chris@0: */ Chris@0: public function invalidate(Request $request); Chris@0: Chris@0: /** Chris@0: * Locks the cache for a given Request. Chris@0: * Chris@0: * @return bool|string true if the lock is acquired, the path to the current lock otherwise Chris@0: */ Chris@0: public function lock(Request $request); Chris@0: Chris@0: /** Chris@0: * Releases the lock for the given Request. Chris@0: * Chris@0: * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise Chris@0: */ Chris@0: public function unlock(Request $request); Chris@0: Chris@0: /** Chris@0: * Returns whether or not a lock exists. Chris@0: * Chris@0: * @return bool true if lock exists, false otherwise Chris@0: */ Chris@0: public function isLocked(Request $request); Chris@0: Chris@0: /** Chris@0: * Purges data for the given URL. Chris@0: * Chris@0: * @param string $url A URL Chris@0: * Chris@0: * @return bool true if the URL exists and has been purged, false otherwise Chris@0: */ Chris@0: public function purge($url); Chris@0: Chris@0: /** Chris@0: * Cleanups storage. Chris@0: */ Chris@0: public function cleanup(); Chris@0: }