ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
sspmod_riak_Store_Store Class Reference
+ Inheritance diagram for sspmod_riak_Store_Store:
+ Collaboration diagram for sspmod_riak_Store_Store:

Public Member Functions

 get ($type, $key)
 Retrieve a value from the datastore. More...
 
 set ($type, $key, $value, $expire=NULL)
 Save a value to the datastore. More...
 
 delete ($type, $key)
 Delete a value from the datastore. 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...
 

Protected Member Functions

 __construct ()
 

Additional Inherited Members

- Static Public Member Functions inherited from SimpleSAML\Store
static getInstance ()
 Retrieve our singleton instance. More...
 

Detailed Description

Definition at line 25 of file Store.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_riak_Store_Store::__construct ( )
protected

Definition at line 26 of file Store.php.

26 {
28
29 $path = $config->getString('path', 'riak-php-client/riak.php');
30 $host = $config->getString('host', 'localhost');
31 $port = $config->getString('port', 8098);
32 $bucket = $config->getString('bucket', 'simpleSAMLphp');
33
34 require_once($path);
35 $this->client = new \RiakClient($host, $port);
36 $this->bucket = $this->client->bucket($bucket);
37 }
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.

References $config, $path, and SimpleSAML_Configuration\getConfig().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

sspmod_riak_Store_Store::delete (   $type,
  $key 
)

Delete a value from the datastore.

Parameters
string$typeThe datatype.
string$keyThe key.

Reimplemented from SimpleSAML\Store.

Definition at line 92 of file Store.php.

92 {
93 assert('is_string($type)');
94 assert('is_string($key)');
95
96 $v = $this->bucket->getBinary("$type.$key");
97 if (!$v->exists()) {
98 return;
99 }
100
101 $v->delete();
102 }

◆ get()

sspmod_riak_Store_Store::get (   $type,
  $key 
)

Retrieve a value from the datastore.

Parameters
string$typeThe datatype.
string$keyThe key.
Returns
mixed|NULL The value.

Reimplemented from SimpleSAML\Store.

Definition at line 46 of file Store.php.

46 {
47 assert('is_string($type)');
48 assert('is_string($key)');
49
50 $v = $this->bucket->getBinary("$type.$key");
51 if (!$v->exists()) {
52 return (NULL);
53 }
54
55 $expires = $v->getIndex('Expires', 'int');
56 if (sizeof($expires) && (int)array_shift($expires) <= time()) {
57 $v->delete();
58 return (NULL);
59 }
60
61 return (unserialize($v->getData()));
62 }

◆ set()

sspmod_riak_Store_Store::set (   $type,
  $key,
  $value,
  $expire = NULL 
)

Save a value to the datastore.

Parameters
string$typeThe datatype.
string$keyThe key.
mixed$valueThe value.
int | NULL$expireThe expiration time (unix timestamp), or NULL if it never expires.

Reimplemented from SimpleSAML\Store.

Definition at line 73 of file Store.php.

73 {
74 assert('is_string($type)');
75 assert('is_string($key)');
76 assert('is_null($expire) || (is_int($expire) && $expire > 2592000)');
77
78 $v = $this->bucket->newBinary("$type.$key", serialize($value), 'application/php');
79 if (!is_null($expire)) {
80 $v->addIndex("Expires", "int", $expire);
81 }
82
83 $v->store();
84 }
$expire
Definition: saml2-acs.php:140

References $expire.


The documentation for this class was generated from the following file: