20 assert(
'is_null($redis) || is_subclass_of($redis, "Predis\\Client")');
22 if (!class_exists(
'\Predis\Client')) {
23 throw new \SimpleSAML\Error\CriticalConfigurationError(
'predis/predis is not available.');
26 if (is_null($redis)) {
27 $config = Configuration::getInstance();
29 $host =
$config->getString(
'store.redis.host',
'localhost');
30 $port =
$config->getInteger(
'store.redis.port', 6379);
31 $prefix =
$config->getString(
'store.redis.prefix',
'SimpleSAMLphp');
33 $redis = new \Predis\Client(
45 $this->redis = $redis;
53 if (method_exists($this->redis,
'disconnect')) {
54 $this->redis->disconnect();
68 assert(
'is_string($type)');
69 assert(
'is_string($key)');
71 $result = $this->redis->get(
"{$type}.{$key}");
90 assert(
'is_string($type)');
91 assert(
'is_string($key)');
92 assert(
'is_null($expire) || (is_int($expire) && $expire > 2592000)');
94 $serialized = serialize($value);
96 if (is_null($expire)) {
97 $this->redis->set(
"{$type}.{$key}", $serialized);
99 $this->redis->setex(
"{$type}.{$key}", $expire, $serialized);
111 assert(
'is_string($type)');
112 assert(
'is_string($key)');
114 $this->redis->del(
"{$type}.{$key}");
Create styles array
The data for the language used.
__destruct()
Deconstruct the Redis data store.
__construct($redis=null)
Initialize the Redis data store.