-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathPersistingStoreInterface.php
More file actions
58 lines (51 loc) · 1.58 KB
/
Copy pathPersistingStoreInterface.php
File metadata and controls
58 lines (51 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Lock;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\LockReleasingException;
/**
* Keeps the state of locks, each of them owned by the Key that acquired it.
*
* Only the owning key can extend or release a lock. Sharing a lock with another
* process requires serializing its key and passing it to that process.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
interface PersistingStoreInterface
{
/**
* Stores the resource if it's not locked by someone else.
*
* @throws LockAcquiringException
* @throws LockConflictedException
*/
public function save(Key $key): void;
/**
* Removes the resource from the storage if the given key owns it.
*
* Does nothing when the lock is owned by another key.
*
* @throws LockReleasingException
*/
public function delete(Key $key): void;
/**
* Returns whether or not the given key owns the lock on the resource.
*/
public function exists(Key $key): bool;
/**
* Extends the TTL of a resource.
*
* @param float $ttl amount of seconds to keep the lock in the store
*
* @throws LockConflictedException
*/
public function putOffExpiration(Key $key, float $ttl): void;
}