BackendInterface.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Lock backend interface.
  4. */
  5. interface Redis_Lock_BackendInterface {
  6. /**
  7. * Acquire lock.
  8. *
  9. * @param string $name
  10. * Lock name.
  11. * @param float $timeout = 30.0
  12. * (optional) Lock lifetime in seconds.
  13. *
  14. * @return bool
  15. */
  16. public function lockAcquire($name, $timeout = 30.0);
  17. /**
  18. * Check if lock is available for acquire.
  19. *
  20. * @param string $name
  21. * Lock to acquire.
  22. *
  23. * @return bool
  24. */
  25. public function lockMayBeAvailable($name);
  26. /**
  27. * Wait a short amount of time before a second lock acquire attempt.
  28. *
  29. * @param string $name
  30. * Lock name currently being locked.
  31. * @param int $delay = 30
  32. * Miliseconds to wait for.
  33. */
  34. public function lockWait($name, $delay = 30);
  35. /**
  36. * Release given lock.
  37. *
  38. * @param string $name
  39. */
  40. public function lockRelease($name);
  41. /**
  42. * Release all locks for the given lock token identifier.
  43. *
  44. * @param string $lockId = NULL
  45. * (optional) If none given, remove all lock from the current page.
  46. */
  47. public function lockReleaseAll($lock_id = NULL);
  48. /**
  49. * Get the unique page token for locks. Locks will be wipeout at each end of
  50. * page request on a token basis.
  51. *
  52. * @return string
  53. */
  54. public function getLockId();
  55. }