|
| __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 20 of file Redis.php.
References $config, and SimpleSAML\Store\Redis\$redis.
22 assert(
$redis === null || is_subclass_of(
$redis,
'Predis\\Client'));
24 if (!class_exists(
'\Predis\Client')) {
25 throw new \SimpleSAML\Error\CriticalConfigurationError(
'predis/predis is not available.');
29 $config = Configuration::getInstance();
31 $host =
$config->getString(
'store.redis.host',
'localhost');
32 $port =
$config->getInteger(
'store.redis.port', 6379);
33 $prefix =
$config->getString(
'store.redis.prefix',
'SimpleSAMLphp');
35 $redis = new \Predis\Client(
◆ __destruct()
SimpleSAML\Store\Redis::__destruct |
( |
| ) |
|
Deconstruct the Redis data store.
Definition at line 53 of file Redis.php.
55 if (method_exists($this->redis,
'disconnect')) {
56 $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 112 of file Redis.php.
References $type.
114 assert(is_string(
$type));
115 assert(is_string(
$key));
117 $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 68 of file Redis.php.
References $key, $result, and $type.
70 assert(is_string(
$type));
71 assert(is_string(
$key));
73 $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 90 of file Redis.php.
References $type.
92 assert(is_string(
$type));
93 assert(is_string(
$key));
96 $serialized = serialize($value);
99 $this->redis->set(
"{$type}.{$key}", $serialized);
102 $this->redis->setex(
"{$type}.{$key}",
$expire - time(), $serialized);
◆ $redis
SimpleSAML\Store\Redis::$redis |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/Store/Redis.php