ICacheFactory.php 1.8 KB

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