IMemcache.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. *
  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. *
  34. * @since 8.1.0
  35. */
  36. interface IMemcache extends ICache {
  37. /**
  38. * Set a value in the cache if it's not already stored
  39. *
  40. * @param string $key
  41. * @param mixed $value
  42. * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
  43. * @return bool
  44. * @since 8.1.0
  45. */
  46. public function add($key, $value, $ttl = 0);
  47. /**
  48. * Increase a stored number
  49. *
  50. * @param string $key
  51. * @param int $step
  52. * @return int | bool
  53. * @since 8.1.0
  54. */
  55. public function inc($key, $step = 1);
  56. /**
  57. * Decrease a stored number
  58. *
  59. * @param string $key
  60. * @param int $step
  61. * @return int | bool
  62. * @since 8.1.0
  63. */
  64. public function dec($key, $step = 1);
  65. /**
  66. * Compare and set
  67. *
  68. * @param string $key
  69. * @param mixed $old
  70. * @param mixed $new
  71. * @return bool
  72. * @since 8.1.0
  73. */
  74. public function cas($key, $old, $new);
  75. /**
  76. * Compare and delete
  77. *
  78. * @param string $key
  79. * @param mixed $old
  80. * @return bool
  81. * @since 8.1.0
  82. */
  83. public function cad($key, $old);
  84. }