Пример #1
0
 /**
  * puts "something" into the cache,
  *      * If this is an object and implements Serializable,
  *      * we use the serial provided by the object
  *      * else a serial must be provided
  *
  * @access public
  * @author Jerome Bogaerts, <*****@*****.**>
  * @param  mixed
  * @param  string serial
  * @return boolean
  * @throws common_exception_Error
  */
 public function put($mixed, $serial = null)
 {
     if ($mixed instanceof common_Serializable) {
         if (!is_null($serial) && $serial != $mixed->getSerial()) {
             throw new common_exception_Error('Serial mismatch for Serializable ' . $mixed->getSerial());
         }
         $serial = $mixed->getSerial();
     }
     return $this->persistence->set($serial, $mixed);
 }
Пример #2
0
 /**
  * @depends testConnect
  * @author Lionel Lecaque, lionel@taotesting.com
  * @param common_persistence_KeyValuePersistence $persistence
  */
 public function testSet($persistence)
 {
     $this->assertFalse($persistence->set('fakeKeyName', 'value'));
 }
Пример #3
0
 /**
  * Store the state of the service call
  * 
  * @param string $userId
  * @param string $callId
  * @param string $data
  * @return boolean
  */
 public function set($userId, $callId, $data)
 {
     $key = $this->getSerial($userId, $callId);
     return $this->persistence->set($key, $data);
 }
Пример #4
0
 /**
  * @depends testConnect
  * @author Lionel Lecaque, lionel@taotesting.com
  * @param common_persistence_KeyValuePersistence $persistence
  */
 public function testPurge($persistence)
 {
     $this->assertTrue($persistence->set('fakeKeyName', 'value'));
     $this->assertTrue($persistence->set('fakeKeyName2', 'value'));
     $this->assertTrue($persistence->exists('fakeKeyName'));
     $this->assertTrue($persistence->exists('fakeKeyName2'));
     $this->assertTrue($persistence->purge());
     $this->assertFalse($this->root->hasChildren());
 }