diff options
author | Andrew Dolgov <[email protected]> | 2022-11-23 22:09:04 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-11-23 22:09:04 +0300 |
commit | 9732d8fc9ff976bea480b663012c6c6ec6dc9f01 (patch) | |
tree | 49932ff52a2fe97655666ba4e06b5988511286f7 /classes/cache | |
parent | 10a1dd35e3188674db61cce3a2cc64fd5fa1f596 (diff) |
update_rss_feed: use DiskCache to store feed data
Diffstat (limited to 'classes/cache')
-rw-r--r-- | classes/cache/adapter.php | 5 | ||||
-rw-r--r-- | classes/cache/local.php | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/classes/cache/adapter.php b/classes/cache/adapter.php index da69c5bb1..88dca21b9 100644 --- a/classes/cache/adapter.php +++ b/classes/cache/adapter.php @@ -9,6 +9,11 @@ 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 + */ + public function get_mtime(string $filename); /** * @param mixed $data * diff --git a/classes/cache/local.php b/classes/cache/local.php index 20d97d9c0..4461ef4ca 100644 --- a/classes/cache/local.php +++ b/classes/cache/local.php @@ -2,6 +2,10 @@ class Cache_Local implements Cache_Adapter { private string $dir; + public function get_mtime(string $filename) { + return filemtime($this->get_full_path($filename)); + } + public function set_dir(string $dir) : void { $this->dir = Config::get(Config::CACHE_DIR) . "/" . basename(clean($dir)); } |