Skip to content

Commit 0101771

Browse files
authored
Merge pull request #450 from saschanowak/main
fix: remove FreezableBackendInterface
2 parents 5972e91 + 17935dd commit 0101771

File tree

1 file changed

+1
-49
lines changed

1 file changed

+1
-49
lines changed

Classes/Cache/RemoteFileBackend.php

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use SFC\Staticfilecache\Exception;
88
use SFC\Staticfilecache\Service\RemoveService;
99
use TYPO3\CMS\Core\Cache\Backend\AbstractBackend;
10-
use TYPO3\CMS\Core\Cache\Backend\FreezableBackendInterface;
1110
use TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface;
1211
use TYPO3\CMS\Core\Cache\Backend\TransientBackendInterface;
1312
use TYPO3\CMS\Core\Cache\Exception\InvalidDataException;
@@ -18,7 +17,7 @@
1817
/**
1918
* RemoteFileBackend.
2019
*/
21-
class RemoteFileBackend extends AbstractBackend implements TaggableBackendInterface, FreezableBackendInterface, TransientBackendInterface
20+
class RemoteFileBackend extends AbstractBackend implements TaggableBackendInterface, TransientBackendInterface
2221
{
2322
/**
2423
* Relative folder name.
@@ -40,11 +39,6 @@ class RemoteFileBackend extends AbstractBackend implements TaggableBackendInterf
4039
*/
4140
public const FILE_EXTENSION_IDENTIFIER = '.cache.ident';
4241

43-
/**
44-
* Is freezed?
45-
*/
46-
protected bool $freeze = false;
47-
4842
/**
4943
* Hash length.
5044
*/
@@ -74,9 +68,6 @@ public function setHashLength(int $hashLength): void
7468
*/
7569
public function set($entryIdentifier, $data, array $tags = [], $lifetime = null): void
7670
{
77-
if ($this->freeze) {
78-
throw new Exception('Backend is frozen!', 123789);
79-
}
8071
$this->remove($entryIdentifier);
8172
$fileName = $this->getFileName($entryIdentifier);
8273

@@ -139,9 +130,6 @@ public function has($entryIdentifier)
139130
if (!is_file($folder . $fileName)) {
140131
return false;
141132
}
142-
if ($this->freeze) {
143-
return true;
144-
}
145133
$validUntil = (int) file_get_contents($folder . $fileName . self::FILE_EXTENSION_LIFETIME);
146134

147135
return $validUntil > time();
@@ -162,9 +150,6 @@ public function has($entryIdentifier)
162150
*/
163151
public function remove($entryIdentifier)
164152
{
165-
if ($this->freeze) {
166-
throw new Exception('Backend is frozen!', 123789);
167-
}
168153
$folder = GeneralUtility::getFileAbsFileName(self::RELATIVE_STORAGE_FOLDER);
169154
$fileName = $this->getFileName($entryIdentifier);
170155
if (!is_file($folder . $fileName)) {
@@ -190,7 +175,6 @@ public function flush(): void
190175
{
191176
$removeService = GeneralUtility::makeInstance(RemoveService::class);
192177
$removeService->directory(GeneralUtility::getFileAbsFileName(self::RELATIVE_STORAGE_FOLDER));
193-
$this->freeze = false;
194178
}
195179

196180
/**
@@ -202,10 +186,6 @@ public function flush(): void
202186
*/
203187
public function collectGarbage(): void
204188
{
205-
if ($this->freeze) {
206-
throw new \Exception('Backend is frozen!', 123789);
207-
}
208-
209189
$lifetimeFiles = glob(GeneralUtility::getFileAbsFileName(self::RELATIVE_STORAGE_FOLDER) . '*/*/*' . self::FILE_EXTENSION_LIFETIME);
210190

211191
$identifiers = [];
@@ -232,9 +212,6 @@ public function collectGarbage(): void
232212
*/
233213
public function flushByTag($tag): void
234214
{
235-
if ($this->freeze) {
236-
throw new \Exception('Backend is frozen!', 123789);
237-
}
238215
$identifiers = $this->findIdentifiersByTag($tag);
239216
foreach ($identifiers as $identifier) {
240217
$this->remove($identifier);
@@ -264,31 +241,6 @@ public function findIdentifiersByTag($tag)
264241
return $identifiers;
265242
}
266243

267-
/**
268-
* Freezes this cache backend.
269-
*
270-
* All data in a frozen backend remains unchanged and methods which try to add
271-
* or modify data result in an exception thrown. Possible expiry times of
272-
* individual cache entries are ignored.
273-
*
274-
* On the positive side, a frozen cache backend is much faster on read access.
275-
* A frozen backend can only be thawn by calling the flush() method.
276-
*/
277-
public function freeze(): void
278-
{
279-
$this->freeze = true;
280-
}
281-
282-
/**
283-
* Tells if this backend is frozen.
284-
*
285-
* @return bool
286-
*/
287-
public function isFrozen()
288-
{
289-
return $this->freeze;
290-
}
291-
292244
/**
293245
* Get filename.
294246
*

0 commit comments

Comments
 (0)