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

MemcacheStore: Remove unused function & variables.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2418 44740490-163a-0410-bde0-09ae8108e29a
parent 62c3fa70
No related branches found
No related tags found
No related merge requests found
...@@ -10,36 +10,18 @@ ...@@ -10,36 +10,18 @@
* @author Olav Morken, UNINETT AS. * @author Olav Morken, UNINETT AS.
* @package simpleSAMLphp * @package simpleSAMLphp
* @version $Id$ * @version $Id$
* @deprecated This class will be removed in version 1.8 of simpleSAMLphp.
*/ */
class SimpleSAML_MemcacheStore { class SimpleSAML_MemcacheStore {
/**
* This variable contains the id for this data.
*
* This variable is serialized.
*/
private $id = NULL;
/** /**
* This variable contains an array with all key-value pairs stored * This variable contains an array with all key-value pairs stored
* in this object. * in this object.
*
* This variable is serialized.
*/ */
private $data = NULL; private $data = NULL;
/**
* This variable indicates whether our shutdown function has been registered.
*
* This variable isn't serialized.
*/
private $shutdownFunctionRegistered = FALSE;
/** /**
* This function is used to find an existing storage object. It will return NULL if no storage object * This function is used to find an existing storage object. It will return NULL if no storage object
* with the given id is found. * with the given id is found.
...@@ -67,36 +49,6 @@ class SimpleSAML_MemcacheStore { ...@@ -67,36 +49,6 @@ class SimpleSAML_MemcacheStore {
} }
/**
* This constructor is used to create a new storage object. The storage object will be created with the
* specified id and the initial content passed in the data argument.
*
* If there exists a storage object with the specified id, then it will be overwritten.
*
* @param $id The id of the storage object.
* @param $data An array containing the initial data of the storage object.
*/
public function __construct($id, $data = array()) {
/* Validate arguments. */
assert(self::isValidID($id));
assert(is_array($data));
$this->id = $id;
$this->data = $data;
}
/**
* This magic function is called on serialization of this class. It returns a list of the names of the
* variables which should be serialized.
*
* @return List of variables which should be serialized.
*/
private function __sleep() {
return array('id', 'data');
}
/** /**
* This function retrieves the specified key from this storage object. * This function retrieves the specified key from this storage object.
* *
...@@ -112,32 +64,6 @@ class SimpleSAML_MemcacheStore { ...@@ -112,32 +64,6 @@ class SimpleSAML_MemcacheStore {
} }
/**
* This function sets the specified key to the specified value in this
* storage object.
*
* @param $key The key we should set.
* @param $value The value we should set the key to.
*/
public function set($key, $value) {
$this->data[$key] = $value;
/* Register the shutdown function if it isn't registered yet. */
if(!$this->shutdownFunctionRegistered) {
$this->registerShutdownFunction();
}
}
/**
* This function stores this storage object to the memcache servers.
*/
public function save() {
/* Write to the memcache servers. */
SimpleSAML_Memcache::set($this->id, serialize($this));
}
/** /**
* This function determines whether the argument is a valid id. * This function determines whether the argument is a valid id.
* A valid id is a string containing lowercase alphanumeric * A valid id is a string containing lowercase alphanumeric
...@@ -162,25 +88,4 @@ class SimpleSAML_MemcacheStore { ...@@ -162,25 +88,4 @@ class SimpleSAML_MemcacheStore {
return TRUE; return TRUE;
} }
/**
* Register our shutdown function.
*/
private function registerShutdownFunction() {
register_shutdown_function(array($this, 'shutdown'));
$this->shutdownFunctionRegistered = TRUE;
}
/**
* Shutdown function. Calls save and updates flag indicating that the function has been called.
*
* This function is only public because this is a requirement of the way callbacks work in PHP.
*/
public function shutdown() {
$this->save();
$this->shutdownFunctionRegistered = FALSE;
}
} }
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment