icache.php 1.8 KB

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