2016-09-05 19:05:19 +03:00
|
|
|
<?php
|
2018-11-16 23:48:59 +03:00
|
|
|
/**
|
|
|
|
* This file is part of RSS-Bridge, a PHP project capable of generating RSS and
|
|
|
|
* Atom feeds for websites that don't have one.
|
|
|
|
*
|
|
|
|
* For the full license information, please view the UNLICENSE file distributed
|
|
|
|
* with this source code.
|
|
|
|
*
|
|
|
|
* @package Core
|
|
|
|
* @license http://unlicense.org/ UNLICENSE
|
|
|
|
* @link https://github.com/rss-bridge/rss-bridge
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cache interface
|
|
|
|
*/
|
2016-09-10 21:41:11 +03:00
|
|
|
interface CacheInterface {
|
2019-04-29 21:12:43 +03:00
|
|
|
/**
|
|
|
|
* Set scope of the current cache
|
|
|
|
*
|
|
|
|
* If $scope is an empty string, the cache is set to a global context.
|
|
|
|
*
|
|
|
|
* @param string $scope The scope the data is related to
|
|
|
|
*/
|
|
|
|
public function setScope($scope);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set key to assign the current data
|
|
|
|
*
|
|
|
|
* Since $key can be anything, the cache implementation must ensure to
|
|
|
|
* assign the related data reliably; most commonly by serializing and
|
|
|
|
* hashing the key in an appropriate way.
|
|
|
|
*
|
|
|
|
* @param array $key The key the data is related to
|
|
|
|
*/
|
|
|
|
public function setKey($key);
|
|
|
|
|
2018-11-16 23:48:59 +03:00
|
|
|
/**
|
|
|
|
* Loads data from cache
|
|
|
|
*
|
2019-04-29 21:12:43 +03:00
|
|
|
* @return mixed The cached data or null
|
2018-11-16 23:48:59 +03:00
|
|
|
*/
|
2016-09-10 21:41:11 +03:00
|
|
|
public function loadData();
|
2018-11-16 23:48:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores data to the cache
|
|
|
|
*
|
2019-04-29 21:12:43 +03:00
|
|
|
* @param mixed $data The data to store
|
2018-11-16 23:48:59 +03:00
|
|
|
* @return self The cache object
|
|
|
|
*/
|
2019-04-29 21:12:43 +03:00
|
|
|
public function saveData($data);
|
2018-11-16 23:48:59 +03:00
|
|
|
|
|
|
|
/**
|
2019-04-29 21:12:43 +03:00
|
|
|
* Returns the timestamp for the curent cache data
|
2018-11-16 23:48:59 +03:00
|
|
|
*
|
2019-04-29 21:12:43 +03:00
|
|
|
* @return int Timestamp or null
|
2018-11-16 23:48:59 +03:00
|
|
|
*/
|
2016-09-10 21:41:11 +03:00
|
|
|
public function getTime();
|
2018-11-16 23:48:59 +03:00
|
|
|
|
|
|
|
/**
|
2019-04-29 21:12:43 +03:00
|
|
|
* Removes any data that is older than the specified age from cache
|
2018-11-16 23:48:59 +03:00
|
|
|
*
|
2019-04-29 21:12:43 +03:00
|
|
|
* @param int $seconds The cache age in seconds
|
2018-11-16 23:48:59 +03:00
|
|
|
*/
|
2019-04-29 21:12:43 +03:00
|
|
|
public function purgeCache($seconds);
|
2016-09-05 19:05:19 +03:00
|
|
|
}
|