Exemplo n.º 1
0
 /**
  * Encrypt the session data, and store it in the cache.
  *
  * @param string $id   The ID of the current session
  * @param string $data The serialized session data
  *
  * @return bool
  */
 public function write($id, $data)
 {
     $this->checkId($id);
     if (!empty($data)) {
         $this->storage->set('session.' . $id, Encrypter::encrypt($data), $this->config->lifetime);
     }
     return true;
 }
Exemplo n.º 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();
 }