icache.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Thomas Müller <thomas.mueller@tmit.eu>
  7. * @author Thomas Tanghus <thomas@tanghus.net>
  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. /**
  25. * Public interface of ownCloud for apps to use.
  26. * Cache interface
  27. *
  28. */
  29. // use OCP namespace for all classes that are considered public.
  30. // This means that they should be used by apps instead of the internal ownCloud classes
  31. namespace OCP;
  32. /**
  33. * This interface defines method for accessing the file based user cache.
  34. * @since 6.0.0
  35. */
  36. interface ICache {
  37. /**
  38. * Get a value from the user cache
  39. * @param string $key
  40. * @return mixed
  41. * @since 6.0.0
  42. */
  43. public function get($key);
  44. /**
  45. * Set a value in the user cache
  46. * @param string $key
  47. * @param mixed $value
  48. * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
  49. * @return bool
  50. * @since 6.0.0
  51. */
  52. public function set($key, $value, $ttl = 0);
  53. /**
  54. * Check if a value is set in the user cache
  55. * @param string $key
  56. * @return bool
  57. * @since 6.0.0
  58. */
  59. public function hasKey($key);
  60. /**
  61. * Remove an item from the user cache
  62. * @param string $key
  63. * @return bool
  64. * @since 6.0.0
  65. */
  66. public function remove($key);
  67. /**
  68. * Clear the user cache of all entries starting with a prefix
  69. * @param string $prefix (optional)
  70. * @return bool
  71. * @since 6.0.0
  72. */
  73. public function clear($prefix = '');
  74. }