Drupal investigation

StoreInterface.php 2.6KB

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