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

SessionHandlerMemcache: Simplify session store.

This patch lays the groundwork for removing the MemcacheStore class later.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2417 44740490-163a-0410-bde0-09ae8108e29a
parent 0b89bc2c
No related branches found
No related tags found
No related merge requests found
......@@ -14,14 +14,6 @@
class SimpleSAML_SessionHandlerMemcache
extends SimpleSAML_SessionHandlerCookie {
/* This variable contains a reference to the MemcacheStore object
* which contains the session data.
*/
private $store = NULL;
/* Initialize the memcache session handling. This constructor is
* protected because it should only be called from
* SimpleSAML_SessionHandler::createSessionHandler(...).
......@@ -32,18 +24,6 @@ extends SimpleSAML_SessionHandlerCookie {
* id.
*/
parent::__construct();
/* Load the session object if it already exists. */
$this->store = SimpleSAML_MemcacheStore::find($this->session_id);
if($this->store === NULL) {
/* We didn't find the session. This may be because the
* session has expired, or it could be because this is
* a new session. In any case we create a new session.
*/
$this->store = new SimpleSAML_MemcacheStore(
$this->session_id);
}
}
......@@ -54,7 +34,7 @@ extends SimpleSAML_SessionHandlerCookie {
*/
public function saveSession(SimpleSAML_Session $session) {
$this->store->set('SimpleSAMLphp_SESSION', serialize($session));
SimpleSAML_Memcache::set('simpleSAMLphp.session.' . $this->session_id, $session);
}
......@@ -65,7 +45,19 @@ extends SimpleSAML_SessionHandlerCookie {
*/
public function loadSession() {
$session = $this->store->get('SimpleSAMLphp_SESSION');
$session = SimpleSAML_Memcache::get('simpleSAMLphp.session.' . $this->session_id);
if ($session !== NULL) {
assert('$session instanceof SimpleSAML_Session');
return $session;
}
/* For backwards compatibility, check the MemcacheStore object. */
$store = SimpleSAML_MemcacheStore::find($this->session_id);
if ($store === NULL) {
return NULL;
}
$session = $store->get('SimpleSAMLphp_SESSION');
if ($session === NULL) {
return NULL;
}
......
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