/** * 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); }
/** * @depends testConnect * @author Lionel Lecaque, lionel@taotesting.com * @param common_persistence_KeyValuePersistence $persistence */ public function testSet($persistence) { $this->assertFalse($persistence->set('fakeKeyName', 'value')); }
/** * 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); }
/** * @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()); }