ICacheFactory.php 1.9 KB

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