icache.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * @author Morris Jobke <hey@morrisjobke.de>
  4. * @author Thomas Müller <thomas.mueller@tmit.eu>
  5. * @author Thomas Tanghus <thomas@tanghus.net>
  6. *
  7. * @copyright Copyright (c) 2015, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. /**
  24. * Public interface of ownCloud for apps to use.
  25. * Cache interface
  26. *
  27. */
  28. // use OCP namespace for all classes that are considered public.
  29. // This means that they should be used by apps instead of the internal ownCloud classes
  30. namespace OCP;
  31. /**
  32. * This interface defines method for accessing the file based user cache.
  33. * @since 6.0.0
  34. */
  35. interface ICache {
  36. /**
  37. * Get a value from the user cache
  38. * @param string $key
  39. * @return mixed
  40. * @since 6.0.0
  41. */
  42. public function get($key);
  43. /**
  44. * Set a value in the user cache
  45. * @param string $key
  46. * @param mixed $value
  47. * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
  48. * @return bool
  49. * @since 6.0.0
  50. */
  51. public function set($key, $value, $ttl = 0);
  52. /**
  53. * Check if a value is set in the user cache
  54. * @param string $key
  55. * @return bool
  56. * @since 6.0.0
  57. */
  58. public function hasKey($key);
  59. /**
  60. * Remove an item from the user cache
  61. * @param string $key
  62. * @return bool
  63. * @since 6.0.0
  64. */
  65. public function remove($key);
  66. /**
  67. * Clear the user cache of all entries starting with a prefix
  68. * @param string $prefix (optional)
  69. * @return bool
  70. * @since 6.0.0
  71. */
  72. public function clear($prefix = '');
  73. }