|
| __construct ($redis=null) |
| Initialize the Redis data store. More...
|
|
| __destruct () |
| Deconstruct the Redis data store. More...
|
|
| get ($type, $key) |
| Retrieve a value from the data store. More...
|
|
| set ($type, $key, $value, $expire=null) |
| Save a value in the data store. More...
|
|
| delete ($type, $key) |
| Delete an entry from the data store. More...
|
|
| get ($type, $key) |
| Retrieve a value from the data store. More...
|
|
| set ($type, $key, $value, $expire=null) |
| Save a value to the data store. More...
|
|
| delete ($type, $key) |
| Delete a value from the data store. More...
|
|
Definition at line 13 of file Redis.php.
◆ __construct()
SimpleSAML\Store\Redis::__construct |
( |
|
$redis = null | ) |
|
Initialize the Redis data store.
Definition at line 18 of file Redis.php.
References $config, and array.
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;
Create styles array
The data for the language used.
◆ __destruct()
SimpleSAML\Store\Redis::__destruct |
( |
| ) |
|
Deconstruct the Redis data store.
Definition at line 51 of file Redis.php.
53 if (method_exists($this->redis,
'disconnect')) {
54 $this->redis->disconnect();
◆ delete()
SimpleSAML\Store\Redis::delete |
( |
|
$type, |
|
|
|
$key |
|
) |
| |
Delete an entry from the data store.
- Parameters
-
string | $type | The type of the data |
string | $key | The key to delete. |
Definition at line 109 of file Redis.php.
111 assert(
'is_string($type)');
112 assert(
'is_string($key)');
114 $this->redis->del(
"{$type}.{$key}");
◆ get()
SimpleSAML\Store\Redis::get |
( |
|
$type, |
|
|
|
$key |
|
) |
| |
Retrieve a value from the data store.
- Parameters
-
string | $type | The type of the data. |
string | $key | The key to retrieve. |
- Returns
- mixed|null The value associated with that key, or null if there's no such key.
Definition at line 66 of file Redis.php.
References $result.
68 assert(
'is_string($type)');
69 assert(
'is_string($key)');
71 $result = $this->redis->get(
"{$type}.{$key}");
◆ set()
SimpleSAML\Store\Redis::set |
( |
|
$type, |
|
|
|
$key, |
|
|
|
$value, |
|
|
|
$expire = null |
|
) |
| |
Save a value in the data store.
- Parameters
-
string | $type | The type of the data. |
string | $key | The key to insert. |
mixed | $value | The value itself. |
int | null | $expire | The expiration time (unix timestamp), or null if it never expires. |
Definition at line 88 of file Redis.php.
90 assert(
'is_string($type)');
91 assert(
'is_string($key)');
92 assert(
'is_null($expire) || (is_int($expire) && $expire > 2592000)');
94 $serialized = serialize($value);
97 $this->redis->set(
"{$type}.{$key}", $serialized);
99 $this->redis->setex(
"{$type}.{$key}",
$expire, $serialized);
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/Store/Redis.php