forked from neos/flow-development-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackendInterface.php
More file actions
106 lines (95 loc) · 3.36 KB
/
Copy pathBackendInterface.php
File metadata and controls
106 lines (95 loc) · 3.36 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
declare(strict_types=1);
namespace Neos\Cache\Backend;
/*
* This file is part of the Neos.Cache package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
use Neos\Cache\Frontend\FrontendInterface;
/**
* A contract for a Cache Backend
*
* @api
*/
interface BackendInterface
{
/**
* Sets a reference to the cache frontend which uses this backend
*
* @param FrontendInterface $cache The frontend for this backend
* @return void
* @api
*/
public function setCache(FrontendInterface $cache): void;
/**
* Returns the internally used, prefixed entry identifier for the given public
* entry identifier.
*
* While Flow applications will mostly refer to the simple entry identifier, it
* may be necessary to know the actual identifier used by the cache backend
* in order to share cache entries with other applications. This method allows
* for retrieving it.
*
* @param string $entryIdentifier
* @return string
*/
public function getPrefixedIdentifier(string $entryIdentifier): string;
/**
* Saves data in the cache.
*
* @param string $entryIdentifier An identifier for this specific cache entry
* @param string $data The data to be stored
* @param array<string> $tags Tags to associate with this cache entry. If the backend does not support tags, this option can be ignored.
* @param integer|null $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
* @return void
* @throws \Neos\Cache\Exception if no cache frontend has been set.
* @throws \InvalidArgumentException if the identifier is not valid
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], ?int $lifetime = null): void;
/**
* Loads data from the cache.
*
* @param string $entryIdentifier An identifier which describes the cache entry to load
* @return mixed The cache entry's content as a string or false if the cache entry could not be loaded
* @api
*/
public function get(string $entryIdentifier);
/**
* Checks if a cache entry with the specified identifier exists.
*
* @param string $entryIdentifier An identifier specifying the cache entry
* @return boolean true if such an entry exists, false if not
* @api
*/
public function has(string $entryIdentifier): bool;
/**
* Removes all cache entries matching the specified identifier.
* Usually this only affects one entry but if - for what reason ever -
* old entries for the identifier still exist, they are removed as well.
*
* @param string $entryIdentifier Specifies the cache entry to remove
* @return boolean true if (at least) an entry could be removed or false if no entry was found
* @api
*/
public function remove(string $entryIdentifier): bool;
/**
* Removes all cache entries of this cache.
*
* @return void
* @api
*/
public function flush(): void;
/**
* Does garbage collection
*
* @return void
* @api
*/
public function collectGarbage(): void;
}