update_rss_feed: use DiskCache to store feed data

This commit is contained in:
Andrew Dolgov
2022-11-23 22:09:04 +03:00
parent 10a1dd35e3
commit 9732d8fc9f
4 changed files with 23 additions and 7 deletions

View File

@@ -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
*

View File

@@ -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));
}