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.

IMemcache.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. // use OCP namespace for all classes that are considered public.
  25. // This means that they should be used by apps instead of the internal ownCloud classes
  26. namespace OCP;
  27. /**
  28. * This interface defines method for accessing the file based user cache.
  29. *
  30. * @since 8.1.0
  31. */
  32. interface IMemcache extends ICache {
  33. /**
  34. * Set a value in the cache if it's not already stored
  35. *
  36. * @param string $key
  37. * @param mixed $value
  38. * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
  39. * @return bool
  40. * @since 8.1.0
  41. */
  42. public function add($key, $value, $ttl = 0);
  43. /**
  44. * Increase a stored number
  45. *
  46. * @param string $key
  47. * @param int $step
  48. * @return int | bool
  49. * @since 8.1.0
  50. */
  51. public function inc($key, $step = 1);
  52. /**
  53. * Decrease a stored number
  54. *
  55. * @param string $key
  56. * @param int $step
  57. * @return int | bool
  58. * @since 8.1.0
  59. */
  60. public function dec($key, $step = 1);
  61. /**
  62. * Compare and set
  63. *
  64. * @param string $key
  65. * @param mixed $old
  66. * @param mixed $new
  67. * @return bool
  68. * @since 8.1.0
  69. */
  70. public function cas($key, $old, $new);
  71. /**
  72. * Compare and delete
  73. *
  74. * @param string $key
  75. * @param mixed $old
  76. * @return bool
  77. * @since 8.1.0
  78. */
  79. public function cad($key, $old);
  80. }