Skip to content
Snippets Groups Projects
Commit 5883b5e1 authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_Memcache: A few cleanups.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1673 44740490-163a-0410-bde0-09ae8108e29a
parent 19c0f945
No related branches found
No related tags found
No related merge requests found
...@@ -225,10 +225,10 @@ class SimpleSAML_Memcache { ...@@ -225,10 +225,10 @@ class SimpleSAML_Memcache {
* This function takes in a list of servers belonging to a group and * This function takes in a list of servers belonging to a group and
* creates a Memcache object from the servers in the group. * creates a Memcache object from the servers in the group.
* *
* @param $group Array of servers which should be created as a group. * @param array $group Array of servers which should be created as a group.
* @return A Memcache object of the servers in the group. * @return A Memcache object of the servers in the group.
*/ */
private static function loadMemcacheServerGroup($group) { private static function loadMemcacheServerGroup(array $group) {
/* Create the Memcache object. */ /* Create the Memcache object. */
$memcache = new Memcache(); $memcache = new Memcache();
if($memcache == NULL) { if($memcache == NULL) {
...@@ -283,20 +283,9 @@ class SimpleSAML_Memcache { ...@@ -283,20 +283,9 @@ class SimpleSAML_Memcache {
/* Load the configuration. */ /* Load the configuration. */
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
assert($config instanceof SimpleSAML_Configuration);
$groups = $config->getValue('memcache_store.servers');
/* Validate the 'memcache_store.servers' configuration option. */ $groups = $config->getArray('memcache_store.servers');
if(is_null($groups)) {
throw new Exception('Unable to get value of the \'memcache_store.servers\'' .
' configuration option.');
}
if(!is_array($groups)) {
throw new Exception('The value of the \'memcache_store.servers\' configuration' .
' option is supposed to be an array.');
}
/* Iterate over all the groups in the 'memcache_store.servers' configuration option. */ /* Iterate over all the groups in the 'memcache_store.servers' configuration option. */
foreach($groups as $index => $group) { foreach($groups as $index => $group) {
...@@ -345,20 +334,7 @@ class SimpleSAML_Memcache { ...@@ -345,20 +334,7 @@ class SimpleSAML_Memcache {
assert($config instanceof SimpleSAML_Configuration); assert($config instanceof SimpleSAML_Configuration);
/* Get the expire-value from the configuration. */ /* Get the expire-value from the configuration. */
$expire = $config->getValue('memcache_store.expires'); $expire = $config->getInteger('memcache_store.expires', 0);
/* If 'memcache_store.expires' isn't defined in the
* configuration, then we will use 0 as the expire parameter.
*/
if($expire === NULL) {
return 0;
}
/* The 'memcache_store.expires' option must be an integer. */
if(!is_integer($expire)) {
throw new Exception('The value of \'memcache_store.expires\' in the' .
' configuration must be a valid integer.');
}
/* It must be a positive integer. */ /* It must be a positive integer. */
if($expire < 0) { if($expire < 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment