ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Store.php
Go to the documentation of this file.
1<?php
2
3namespace SimpleSAML;
4
6
12abstract class Store
13{
21 private static $instance;
22
23
31 public static function getInstance()
32 {
33 if (self::$instance !== null) {
34 return self::$instance;
35 }
36
38 $storeType = $config->getString('store.type', null);
39 if ($storeType === null) {
40 $storeType = $config->getString('session.handler', 'phpsession');
41 }
42
43 switch ($storeType) {
44 case 'phpsession':
45 // we cannot support advanced features with the PHP session store
46 self::$instance = false;
47 break;
48 case 'memcache':
49 self::$instance = new Store\Memcache();
50 break;
51 case 'sql':
52 self::$instance = new Store\SQL();
53 break;
54 case 'redis':
55 self::$instance = new Store\Redis();
56 break;
57 default:
58 // datastore from module
59 try {
60 $className = Module::resolveClass($storeType, 'Store', '\SimpleSAML\Store');
61 } catch (\Exception $e) {
62 $c = $config->toArray();
63 $c['store.type'] = 'phpsession';
65 "Invalid 'store.type' configuration option. Cannot find store '$storeType'.",
66 null,
67 $c
68 );
69 }
70 self::$instance = new $className();
71 }
72
73 return self::$instance;
74 }
75
76
85 abstract public function get($type, $key);
86
87
96 abstract public function set($type, $key, $value, $expire = null);
97
98
105 abstract public function delete($type, $key);
106}
An exception for terminatinating execution or to throw for unit testing.
static $instance
Definition: Store.php:21
static getInstance()
Retrieve our singleton instance.
Definition: Store.php:31
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
$key
Definition: croninfo.php:18
$config
Definition: bootstrap.php:15
$expire
Definition: saml2-acs.php:140
Attribute-related utility methods.
$type