?BaseDataCache.php 0000644 00000012613 14733467753 0007673 0 ustar 00 cache = $cache;
}
/**
* Fetches a value from the cache.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::get()
*
* public function get(string $key, mixed $default = null): mixed;
*
*
* @param string $key The unique key of this item in the cache.
* @param mixed $default Default value to return if the key does not exist.
*
* @return array|mixed The value of the item from the cache, or $default in case of cache miss.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function get_data(string $key, $default = null)
{
$data = $this->cache->load();
if (!is_array($data)) {
return $default;
}
// ignore data if internal cache expiration time is not set
if (!array_key_exists('__cache_expiration_time', $data)) {
return $default;
}
// ignore data if internal cache expiration time is expired
if ($data['__cache_expiration_time'] < time()) {
return $default;
}
// remove internal cache expiration time
unset($data['__cache_expiration_time']);
return $data;
}
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::set()
*
* public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool;
*
*
* @param string $key The key of the item to store.
* @param array $value The value of the item to store, must be serializable.
* @param null|int $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function set_data(string $key, array $value, ?int $ttl = null): bool
{
if ($ttl === null) {
$ttl = 3600;
}
// place internal cache expiration time
$value['__cache_expiration_time'] = time() + $ttl;
return $this->cache->save($value);
}
/**
* Delete an item from the cache by its unique key.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::delete()
*
* public function delete(string $key): bool;
*
*
* @param string $key The unique cache key of the item to delete.
*
* @return bool True if the item was successfully removed. False if there was an error.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function delete_data(string $key): bool
{
return $this->cache->unlink();
}
}
Base.php 0000644 00000004573 14733467753 0006163 0 ustar 00 cache = $cache;
}
/**
* Fetches a value from the cache.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::get()
*
* public function get(string $key, mixed $default = null): mixed;
*
*
* @param string $key The unique key of this item in the cache.
* @param mixed $default Default value to return if the key does not exist.
*
* @return array|mixed The value of the item from the cache, or $default in case of cache miss.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function get_data(string $key, $default = null)
{
$data = $this->cache->get($key, $default);
if (!is_array($data) || $data === $default) {
return $default;
}
return $data;
}
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::set()
*
* public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool;
*
*
* @param string $key The key of the item to store.
* @param array $value The value of the item to store, must be serializable.
* @param null|int $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function set_data(string $key, array $value, ?int $ttl = null): bool
{
return $this->cache->set($key, $value, $ttl);
}
/**
* Delete an item from the cache by its unique key.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::delete()
*
* public function delete(string $key): bool;
*
*
* @param string $key The unique cache key of the item to delete.
*
* @return bool True if the item was successfully removed. False if there was an error.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function delete_data(string $key): bool
{
return $this->cache->delete($key);
}
}
DataCache.php 0000644 00000011167 14733467753 0007103 0 ustar 00
* public function get(string $key, mixed $default = null): mixed;
*
*
* @param string $key The unique key of this item in the cache.
* @param mixed $default Default value to return if the key does not exist.
*
* @return array|mixed The value of the item from the cache, or $default in case of cache miss.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function get_data(string $key, $default = null);
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::set()
*
* public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool;
*
*
* @param string $key The key of the item to store.
* @param array $value The value of the item to store, must be serializable.
* @param null|int $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function set_data(string $key, array $value, ?int $ttl = null): bool;
/**
* Delete an item from the cache by its unique key.
*
* Equivalent to \Psr\SimpleCache\CacheInterface::delete()
*
* public function delete(string $key): bool;
*
*
* @param string $key The unique cache key of the item to delete.
*
* @return bool True if the item was successfully removed. False if there was an error.
*
* @throws InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function delete_data(string $key): bool;
}
Memcache.php 0000644 00000004617 14733467753 0007012 0 ustar 00
* @link http://galvani.cz/
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version 0.2.9
*/
use SimplePie\Cache\Redis;
class_exists('SimplePie\Cache\Redis');
// @trigger_error(sprintf('Using the "SimplePie_Cache_Redis" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Redis" instead.'), \E_USER_DEPRECATED);
if (\false) {
/** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Redis" instead */
class SimplePie_Cache_Redis extends Redis
{
}
}
MySQL.php 0000644 00000004572 14733467753 0006255 0 ustar 00 callable = $callable;
}
/**
* Method to create cache filename with.
*
* The returning name MUST follow the rules for keys in PSR-16.
*
* @link https://www.php-fig.org/psr/psr-16/
*
* The returning name MUST be a string of at least one character
* that uniquely identifies a cached item, MUST only contain the
* characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding
* and MUST not longer then 64 characters. The following characters
* are reserved for future extensions and MUST NOT be used: {}()/\@:
*
* A provided implementing library MAY support additional characters
* and encodings or longer lengths, but MUST support at least that
* minimum.
*
* @param string $name The name for the cache will be most likly an url with query string
*
* @return string the new cache name
*/
public function filter(string $name): string
{
return call_user_func($this->callable, $name);
}
}
File.php 0000644 00000004563 14733467753 0006167 0 ustar 00