diff options
author | Andrew Dolgov <[email protected]> | 2022-11-24 23:19:05 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-11-24 23:19:05 +0300 |
commit | e6b5818a51d71535d5fad1903a2858c39e8ff027 (patch) | |
tree | 0c1a6f452291f20657c2e2ec84f76e277f3cf887 /init.php | |
parent | 94e90cbc8ff9b0ee2a7f4490830c5b10817a308e (diff) |
implement remove() and support for .no-auto-expiry
Diffstat (limited to 'init.php')
-rw-r--r-- | init.php | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -16,6 +16,10 @@ class Cache_S3 extends Plugin implements Cache_Adapter { const CACHE_S3_ACCESS_KEY = "CACHE_S3_ACCESS_KEY"; const CACHE_S3_SECRET_KEY = "CACHE_S3_SECRET_KEY"; + public function remove(string $filename): bool { + return unlink($this->get_full_path($filename)); + } + function about() { return array(null, "File cache backend using S3 protocol (experimental)", @@ -110,7 +114,9 @@ class Cache_S3 extends Plugin implements Cache_Adapter { if ($dh) { while (($file = readdir($dh)) !== false) { - if (is_dir($this->get_full_path($file))) { + $full_path = $this->get_full_path($file); + + if (is_dir($full_path) && !file_exists("$full_path/.no-auto-expiry")) { array_push($rules, [ 'ID' => $file, @@ -125,6 +131,7 @@ class Cache_S3 extends Plugin implements Cache_Adapter { ); } } + closedir($dh); } try { |