-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathStorageInterface.php
46 lines (40 loc) · 1.07 KB
/
StorageInterface.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
<?php
namespace NPR\One\Interfaces;
/**
* Establishes a set of requirements for the storage provider for the project
*
* @package NPR\One\Interfaces
*/
interface StorageInterface
{
/**
* Stores a value for a given key across PHP sessions
*
* @param string $key
* @param mixed $value
* @param null|int $expiresIn An optional TTL (in seconds) for the data, relative to the current Unix timestamp
*/
public function set($key, $value, $expiresIn = null);
/**
* Gets a value for a given key across PHP sessions
*
* @param string $key
* @return mixed
*/
public function get($key);
/**
* The provided $key should be used to lookup a value and then compare
* that value to the $value provided. If they match, return true. If not, false.
*
* @param string $key
* @param mixed $value
* @return bool
*/
public function compare($key, $value): bool;
/**
* Remove all data associated with a given key
*
* @param string $key
*/
public function remove($key);
}