You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.1 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <robin@icewind.nl>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  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. *
  35. * @since 8.1.0
  36. */
  37. interface IMemcache extends ICache {
  38. /**
  39. * Set a value in the cache if it's not already stored
  40. *
  41. * @param string $key
  42. * @param mixed $value
  43. * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
  44. * @return bool
  45. * @since 8.1.0
  46. */
  47. public function add($key, $value, $ttl = 0);
  48. /**
  49. * Increase a stored number
  50. *
  51. * @param string $key
  52. * @param int $step
  53. * @return int | bool
  54. * @since 8.1.0
  55. */
  56. public function inc($key, $step = 1);
  57. /**
  58. * Decrease a stored number
  59. *
  60. * @param string $key
  61. * @param int $step
  62. * @return int | bool
  63. * @since 8.1.0
  64. */
  65. public function dec($key, $step = 1);
  66. /**
  67. * Compare and set
  68. *
  69. * @param string $key
  70. * @param mixed $old
  71. * @param mixed $new
  72. * @return bool
  73. * @since 8.1.0
  74. */
  75. public function cas($key, $old, $new);
  76. /**
  77. * Compare and delete
  78. *
  79. * @param string $key
  80. * @param mixed $old
  81. * @return bool
  82. * @since 8.1.0
  83. */
  84. public function cad($key, $old);
  85. }