getString('store.type', null); if ($storeType === null) { $storeType = $config->getString('session.handler', 'phpsession'); } switch ($storeType) { case 'phpsession': // we cannot support advanced features with the PHP session store self::$instance = false; break; case 'memcache': self::$instance = new SimpleSAML_Store_Memcache(); break; case 'sql': self::$instance = new SimpleSAML_Store_SQL(); break; default: // datastore from module try { $className = SimpleSAML\Module::resolveClass($storeType, 'Store', 'SimpleSAML_Store'); } catch (Exception $e) { $c = $config->toArray(); $c['store.type'] = 'phpsession'; throw new SimpleSAML\Error\CriticalConfigurationError( "Invalid 'store.type' configuration option. Cannot find store '$storeType'.", null, $c ); } self::$instance = new $className(); } return self::$instance; } /** * Retrieve a value from the data store. * * @param string $type The data type. * @param string $key The key. * * @return mixed|null The value. */ abstract public function get($type, $key); /** * Save a value to the data store. * * @param string $type The data type. * @param string $key The key. * @param mixed $value The value. * @param int|null $expire The expiration time (unix timestamp), or null if it never expires. */ abstract public function set($type, $key, $value, $expire = null); /** * Delete a value from the data store. * * @param string $type The data type. * @param string $key The key. */ abstract public function delete($type, $key); }