Lines Matching defs:cache

516     private $cache = null;
525 * @var bool Force SimplePie to fallback to expired cache, if enabled,
540 * @var int Auto-discovery cache duration (in seconds)
551 public $cache_location = './cache';
554 * @var string Function that creates the cache filename
685 * Previously, it was possible to pass in the feed URL along with cache
872 * However, disabling the cache can lead to longer load times.
883 * Set a PSR-16 implementation as cache
885 * @param CacheInterface $psr16cache The PSR-16 cache implementation
889 public function set_cache(CacheInterface $cache)
891 $this->cache = new Psr16($cache);
895 * SimplePie to continue to fall back to expired cache, if enabled, when
898 * This tells SimplePie to ignore any file errors and fall back to cache
902 * @deprecated since SimplePie 1.8.0, expired cache will not be used anymore.
904 * @param bool $enable Force use of cache on fail.
908 // @trigger_error(sprintf('SimplePie\SimplePie::force_cache_fallback() is deprecated since SimplePie 1.8.0, expired cache will not be used anymore.'), \E_USER_DEPRECATED);
916 * @param int $seconds The feed content cache duration
927 * @param int $seconds The autodiscovered feed URL cache duration.
941 public function set_cache_location($location = './cache')
948 * Return the filename (i.e. hash, without path and without extension) of the file to cache a given URL.
955 // Append custom parameters to the URL to avoid cache pollution in case of multiple calls with different parameters.
1305 * Set a namefilter to modify the cache filename with
1317 * Set callback function to create cache filename with
1552 $this->cache
1580 $cache = false;
1587 $cache = $this->get_cache($this->feed_url);
1591 if (($fetched = $this->fetch_data($cache)) === true) {
1669 if ($cache && ! $cache->set_data($this->get_cache_filename($this->feed_url), $this->data, $this->cache_duration)) {
1709 * @param Base|DataCache|false $cache Cache handler, or false to not load from the cache
1710 * @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type
1712 protected function fetch_data(&$cache)
1714 if (is_object($cache) && $cache instanceof Base) {
1715 // @trigger_error(sprintf('Providing $cache as "\SimplePie\Cache\Base" in %s() is deprecated since SimplePie 1.8.0, please provide "\SimplePie\Cache\DataCache" implementation instead.', __METHOD__), \E_USER_DEPRECATED);
1716 $cache = new BaseDataCache($cache);
1719 if ($cache !== false && ! $cache instanceof DataCache) {
1721 '%s(): Argument #1 ($cache) must be of type %s|false',
1729 // If it's enabled, use the cache
1730 if ($cache) {
1732 $this->data = $cache->get_data($cacheKey, []);
1735 // If the cache is for an outdated build of SimplePie
1737 $cache->delete_data($cacheKey);
1742 $cache = false;
1752 $cache->set_data($this->get_cache_filename($this->feed_url), $this->data, $this->autodiscovery_cache_duration);
1757 $cache->delete_data($this->get_cache_filename($this->feed_url));
1760 // Check if the cache has been updated
1782 // Set raw_data to false here too, to signify that the cache
1785 $cache->set_data($cacheKey, $this->data, $this->cache_duration);
1791 $cache->set_data($cacheKey, $this->data, $this->cache_duration);
1799 // If the cache is still valid, just return true
1805 // If the cache is empty
1811 // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
1887 if ($cache) {
1895 if (!$cache->set_data($cacheKey, $this->data, $this->cache_duration)) {
1939 * @return string|boolean Raw XML data, false if the cache is used
3213 if ($this->cache === null) {
3214 // @trigger_error(sprintf('Not providing as PSR-16 cache implementation is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()".'), \E_USER_DEPRECATED);
3215 $cache = $this->registry->call(Cache::class, 'get_handler', [
3221 return new BaseDataCache($cache);
3224 return $this->cache;