ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Memcache.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SimpleSAML\Store;
4 
5 use \SimpleSAML_Configuration as Configuration;
6 use \SimpleSAML\Store;
7 
13 class Memcache extends Store
14 {
20  private $prefix;
21 
22 
26  protected function __construct()
27  {
28  $config = Configuration::getInstance();
29  $this->prefix = $config->getString('memcache_store.prefix', 'simpleSAMLphp');
30  }
31 
32 
40  public function get($type, $key)
41  {
42  assert(is_string($type));
43  assert(is_string($key));
44 
45  return \SimpleSAML_Memcache::get($this->prefix . '.' . $type . '.' . $key);
46  }
47 
48 
57  public function set($type, $key, $value, $expire = null)
58  {
59  assert(is_string($type));
60  assert(is_string($key));
61  assert($expire === null || (is_int($expire) && $expire > 2592000));
62 
63  if ($expire === null) {
64  $expire = 0;
65  }
66 
67  \SimpleSAML_Memcache::set($this->prefix . '.' . $type . '.' . $key, $value, $expire);
68  }
69 
70 
77  public function delete($type, $key)
78  {
79  assert(is_string($type));
80  assert(is_string($key));
81 
82  \SimpleSAML_Memcache::delete($this->prefix . '.' . $type . '.' . $key);
83  }
84 }
$expire
Definition: saml2-acs.php:140
$config
Definition: bootstrap.php:15
$type
static set($key, $value, $expire=null)
Save a key-value pair to the memcache servers.
Definition: Memcache.php:149
get(string $class_name)
__construct()
This function implements the constructor for this class.
Definition: Memcache.php:26
static delete($key)
Delete a key-value pair from the memcache servers.
Definition: Memcache.php:179
$key
Definition: croninfo.php:18