1 | <?php |
||
19 | class BlobStore { |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $namespace; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $namespacePrefix = 'blobstore'; |
||
30 | |||
31 | /** |
||
32 | * @var Cache |
||
33 | */ |
||
34 | private $cache; |
||
35 | |||
36 | /** |
||
37 | * @var Cache |
||
38 | */ |
||
39 | private $internalCache; |
||
40 | |||
41 | /** |
||
42 | * @var boolean |
||
43 | */ |
||
44 | private $usageState = true; |
||
45 | |||
46 | /** |
||
47 | * 0 = stored indefinitely until it is removed or dropped |
||
48 | * |
||
49 | * @var integer |
||
50 | */ |
||
51 | private $expiry = 0; |
||
52 | |||
53 | /** |
||
54 | * @since 1.0 |
||
55 | * |
||
56 | * @param string $namespace |
||
57 | * @param Cache $cache |
||
58 | */ |
||
59 | 17 | public function __construct( $namespace, Cache $cache ) { |
|
72 | |||
73 | /** |
||
74 | * @since 1.0 |
||
75 | * |
||
76 | * @return boolean |
||
77 | */ |
||
78 | 1 | public function canUse() { |
|
81 | |||
82 | /** |
||
83 | * Specifies whether the instance can be generally used or not |
||
84 | * |
||
85 | * @since 1.0 |
||
86 | * |
||
87 | * @param boolean $usageState |
||
88 | */ |
||
89 | 1 | public function setUsageState( $usageState ) { |
|
92 | |||
93 | /** |
||
94 | * Specifies the expiry / time to live for stored containers in seconds |
||
95 | * |
||
96 | * @since 1.0 |
||
97 | * |
||
98 | * @param integer $expiry |
||
99 | */ |
||
100 | 2 | public function setExpiryInSeconds( $expiry ) { |
|
103 | |||
104 | /** |
||
105 | * @since 1.0 |
||
106 | * |
||
107 | * @param string $prefix |
||
108 | */ |
||
109 | 1 | public function setNamespacePrefix( $prefix ) { |
|
112 | |||
113 | /** |
||
114 | * @since 1.0 |
||
115 | * |
||
116 | * @param string $id |
||
117 | * |
||
118 | * @return boolean |
||
119 | */ |
||
120 | 2 | public function exists( $id ) { |
|
123 | |||
124 | /** |
||
125 | * @since 1.0 |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | 1 | public function getStats() { |
|
134 | |||
135 | /** |
||
136 | * @since 1.0 |
||
137 | * |
||
138 | * @param string $id |
||
139 | * |
||
140 | * @return Container |
||
141 | */ |
||
142 | 10 | public function read( $id ) { |
|
162 | |||
163 | /** |
||
164 | * @since 1.0 |
||
165 | * |
||
166 | * @param Container $container |
||
167 | */ |
||
168 | 5 | public function save( Container $container ) { |
|
184 | |||
185 | /** |
||
186 | * @since 1.0 |
||
187 | * |
||
188 | * @param string $id |
||
189 | */ |
||
190 | 3 | public function delete( $id ) { |
|
203 | |||
204 | /** |
||
205 | * @since 1.0 |
||
206 | */ |
||
207 | 1 | public function drop() { |
|
215 | |||
216 | 10 | private function getKey( $id ) { |
|
224 | |||
225 | } |
||
226 |