1
0

ICacheFactory.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP;
  26. /**
  27. * Interface ICacheFactory
  28. *
  29. * @package OCP
  30. * @since 7.0.0
  31. */
  32. interface ICacheFactory{
  33. /**
  34. * Get a distributed memory cache instance
  35. *
  36. * All entries added trough the cache instance will be namespaced by $prefix to prevent collisions between apps
  37. *
  38. * @param string $prefix
  39. * @return ICache
  40. * @since 7.0.0
  41. * @deprecated 13.0.0 Use either createLocking, createDistributed or createLocal
  42. */
  43. public function create(string $prefix = ''): ICache;
  44. /**
  45. * Check if any memory cache backend is available
  46. *
  47. * @return bool
  48. * @since 7.0.0
  49. */
  50. public function isAvailable(): bool;
  51. /**
  52. * Check if a local memory cache backend is available
  53. *
  54. * @return bool
  55. * @since 14.0.0
  56. */
  57. public function isLocalCacheAvailable(): bool;
  58. /**
  59. * create a cache instance for storing locks
  60. *
  61. * @param string $prefix
  62. * @return IMemcache
  63. * @since 13.0.0
  64. */
  65. public function createLocking(string $prefix = ''): IMemcache;
  66. /**
  67. * create a distributed cache instance
  68. *
  69. * @param string $prefix
  70. * @return ICache
  71. * @since 13.0.0
  72. */
  73. public function createDistributed(string $prefix = ''): ICache;
  74. /**
  75. * create a local cache instance
  76. *
  77. * @param string $prefix
  78. * @return ICache
  79. * @since 13.0.0
  80. */
  81. public function createLocal(string $prefix = ''): ICache;
  82. }