blob: 03f633a07a21c1148a6ec445ea3faf7779e1f5d7 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Illuminate\Contracts\Cache;
4
5interface Lock
6{
7 /**
8 * Attempt to acquire the lock.
9 *
10 * @param callable|null $callback
11 * @return mixed
12 */
13 public function get($callback = null);
14
15 /**
16 * Attempt to acquire the lock for the given number of seconds.
17 *
18 * @param int $seconds
19 * @param callable|null $callback
20 * @return mixed
21 */
22 public function block($seconds, $callback = null);
23
24 /**
25 * Release the lock.
26 *
27 * @return bool
28 */
29 public function release();
30
31 /**
32 * Returns the current owner of the lock.
33 *
34 * @return string
35 */
36 public function owner();
37
38 /**
39 * Releases this lock in disregard of ownership.
40 *
41 * @return void
42 */
43 public function forceRelease();
44}