Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ianlintner-wf/c9549889dc5175489fa59355154cf917 to your computer and use it in GitHub Desktop.
Save ianlintner-wf/c9549889dc5175489fa59355154cf917 to your computer and use it in GitHub Desktop.
Redis custom cache for simple saml cache clear all
<?php
$config = \SimpleSAML_Configuration::getInstance();
$red = new \SimpleSAML\Store\Redis();
$conf = array(
'host' => $config->getString('store.redis.host', 'localhost'),
'port' => $config->getInteger('store.redis.port', 6379),
'prefix' => $config->getString('store.redis.prefix', 'SimpleSAMLphp'),
'scheme' => 'tcp',
);
if (!empty($config->getString('store.redis.password',''))) {
$conf['password'] = $config->getString('store.redis.password','');
}
/***
* @var \Redis_Client
*/
$redis = $red->get_client($conf);
$redis->_prefix(
$config->getString('store.redis.prefix', 'SimpleSAMLphp'));
if (!empty($config->getString('store.redis.password',''))) {
$redis->auth($config->getString('store.redis.password',''));
}
$redis->flushAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment