forked from symfony/lock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PersistingStoreInterface.php
53 lines (46 loc) · 1.26 KB
/
PersistingStoreInterface.php
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
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* 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;
/**
* @author Jérémy Derussé <[email protected]>
*/
interface PersistingStoreInterface
{
/**
* Stores the resource if it's not locked by someone else.
*
* @throws LockAcquiringException
* @throws LockConflictedException
*/
public function save(Key $key);
/**
* Removes a resource from the storage.
*
* @throws LockReleasingException
*/
public function delete(Key $key);
/**
* Returns whether or not the resource exists in the storage.
*
* @return bool
*/
public function exists(Key $key);
/**
* 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);
}