imemcache.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * @author Morris Jobke <hey@morrisjobke.de>
  4. * @author Robin Appelman <icewind@owncloud.com>
  5. *
  6. * @copyright Copyright (c) 2015, ownCloud, Inc.
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program 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 License, version 3,
  19. * along with this program. 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. * @since 8.1.0
  34. */
  35. interface IMemcache extends ICache {
  36. /**
  37. * Set a value in the cache if it's not already stored
  38. *
  39. * @param string $key
  40. * @param mixed $value
  41. * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
  42. * @return bool
  43. * @since 8.1.0
  44. */
  45. public function add($key, $value, $ttl = 0);
  46. /**
  47. * Increase a stored number
  48. *
  49. * @param string $key
  50. * @param int $step
  51. * @return int | bool
  52. * @since 8.1.0
  53. */
  54. public function inc($key, $step = 1);
  55. /**
  56. * Decrease a stored number
  57. *
  58. * @param string $key
  59. * @param int $step
  60. * @return int | bool
  61. * @since 8.1.0
  62. */
  63. public function dec($key, $step = 1);
  64. /**
  65. * Compare and set
  66. *
  67. * @param string $key
  68. * @param mixed $old
  69. * @param mixed $new
  70. * @return bool
  71. * @since 8.1.0
  72. */
  73. public function cas($key, $old, $new);
  74. /**
  75. * Compare and delete
  76. *
  77. * @param string $key
  78. * @param mixed $old
  79. * @return bool
  80. * @since 8.1.0
  81. */
  82. public function cad($key, $old);
  83. }