Region.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\ORM\Cache;
  20. /**
  21. * Defines a contract for accessing a particular named region.
  22. */
  23. interface Region extends MultiGetRegion
  24. {
  25. /**
  26. * Retrieve the name of this region.
  27. *
  28. * @return string The region name
  29. */
  30. public function getName();
  31. /**
  32. * Determine whether this region contains data for the given key.
  33. *
  34. * @param CacheKey $key The cache key
  35. *
  36. * @return bool TRUE if the underlying cache contains corresponding data; FALSE otherwise.
  37. */
  38. public function contains(CacheKey $key);
  39. /**
  40. * Get an item from the cache.
  41. *
  42. * @param CacheKey $key The key of the item to be retrieved.
  43. *
  44. * @return CacheEntry|null The cached entry or NULL
  45. *
  46. * @throws CacheException Indicates a problem accessing the item or region.
  47. */
  48. public function get(CacheKey $key);
  49. /**
  50. * Put an item into the cache.
  51. *
  52. * @param CacheKey $key The key under which to cache the item.
  53. * @param CacheEntry $entry The entry to cache.
  54. * @param Lock $lock The lock previously obtained.
  55. *
  56. * @throws CacheException Indicates a problem accessing the region.
  57. */
  58. public function put(CacheKey $key, CacheEntry $entry, ?Lock $lock = null);
  59. /**
  60. * Remove an item from the cache.
  61. *
  62. * @param CacheKey $key The key under which to cache the item.
  63. *
  64. * @throws CacheException Indicates a problem accessing the region.
  65. */
  66. public function evict(CacheKey $key);
  67. /**
  68. * Remove all contents of this particular cache region.
  69. *
  70. * @throws CacheException Indicates problem accessing the region.
  71. */
  72. public function evictAll();
  73. }