IMemcacheTTL.php 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP;
  8. /**
  9. * Interface for memcache backends that support setting ttl after the value is set
  10. *
  11. * @since 8.2.2
  12. */
  13. interface IMemcacheTTL extends IMemcache {
  14. /**
  15. * Set the ttl for an existing value
  16. *
  17. * @param string $key
  18. * @param int $ttl time to live in seconds
  19. * @since 8.2.2
  20. */
  21. public function setTTL(string $key, int $ttl);
  22. /**
  23. * Get the ttl for an existing value, in seconds till expiry
  24. *
  25. * @return int|false
  26. * @since 27
  27. */
  28. public function getTTL(string $key): int|false;
  29. /**
  30. * Set the ttl for an existing value if the value matches
  31. *
  32. * @param string $key
  33. * @param mixed $value
  34. * @param int $ttl time to live in seconds
  35. * @since 27
  36. */
  37. public function compareSetTTL(string $key, $value, int $ttl): bool;
  38. }