summaryrefslogtreecommitdiff
path: root/classes/cache
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-11-24 18:49:36 +0300
committerAndrew Dolgov <[email protected]>2022-11-24 18:49:36 +0300
commitbe6bc72a742c5fb7f87a4495009ed71ff0fbb8d8 (patch)
tree332c7c5fd0dcccd929bb81203f54290f7ea5cf21 /classes/cache
parent3180b358076011d6a65b93bfa9323465447c755d (diff)
DiskCache: tweak how expiration is invoked
Diffstat (limited to 'classes/cache')
-rw-r--r--classes/cache/adapter.php3
-rw-r--r--classes/cache/local.php2
2 files changed, 3 insertions, 2 deletions
diff --git a/classes/cache/adapter.php b/classes/cache/adapter.php
index a61e5cb83..514a14685 100644
--- a/classes/cache/adapter.php
+++ b/classes/cache/adapter.php
@@ -9,7 +9,6 @@ interface Cache_Adapter {
* @return int|false -1 if the file doesn't exist, false if an error occurred, size in bytes otherwise
*/
public function get_size(string $filename);
-
/**
* @return int|false -1 if the file doesn't exist, false if an error occurred, timestamp otherwise
*/
@@ -30,5 +29,7 @@ interface Cache_Adapter {
* @return bool|int false if the file doesn't exist (or unreadable) or isn't audio/video, true if a plugin handled, otherwise int of bytes sent
*/
public function send(string $filename);
+
+ /** Catchall function to expire all subfolders/prefixes in the cache, invoked on the backend */
public function expire_all(): void;
}
diff --git a/classes/cache/local.php b/classes/cache/local.php
index 62f33662a..fb8aed529 100644
--- a/classes/cache/local.php
+++ b/classes/cache/local.php
@@ -94,7 +94,7 @@ class Cache_Local implements Cache_Adapter {
if ($files) {
foreach ($files as $file) {
- if (time() - filemtime($file) > 86400*Config::get(Config::CACHE_MAX_DAYS)) {
+ if (time() - filemtime($file) > 86400 * Config::get(Config::CACHE_MAX_DAYS)) {
unlink($file);
++$num_deleted;