expires) { return $element->data; } // Remove file if expired unlink(self::CACHE_PATH . $cache_key . '.json'); } return false; } public function set(string $cache_key, mixed $data, $timeout = 3600) { file_put_contents(self::CACHE_PATH . $cache_key . '.json', json_encode([ 'data' => $data, 'expires' => time() + $timeout ])); } }