Beispiel #1
0
 /**
  * Retrieve the session payload from the cache, and decrypt it.
  *
  * @param string $id The ID of the current session
  *
  * @return string The serialized session data
  */
 public function read($id)
 {
     $this->checkId($id);
     if (($payload = $this->storage->get('session.' . $id, false)) !== null) {
         return Encrypter::decrypt($payload);
     }
     return;
 }
Beispiel #2
0
 /**
  * Test that values can be cleared correctly.
  *
  * @depends testBootstrap
  *
  * @covers Molovo\Amnesia\Cache\Instance::clear
  * @covers Molovo\Amnesia\Driver\File::clear
  *
  * @uses Molovo\Amnesia\Cache\Instance::mset
  * @uses Molovo\Amnesia\Cache\Instance::mget
  * @uses Molovo\Amnesia\Cache\Instance::encode
  * @uses Molovo\Amnesia\Cache\Instance::decode
  * @uses Molovo\Amnesia\Driver\File::mset
  * @uses Molovo\Amnesia\Driver\File::mget
  */
 public function testClear()
 {
     static::$instance->set('key', 'value');
     $value = static::$instance->get('key');
     verify($value)->equals('value');
     static::$instance->clear('key');
     $value = static::$instance->get('key');
     verify($value)->null();
 }