/**
  * Test load method correctly
  */
 public function testLoadObject()
 {
     $object = new TestClass('value');
     $object->publicParam = 'public';
     $this->memoryCache->save(self::KEY, $object);
     $this->assertEquals($object, $this->memoryCache->load(self::KEY));
     $object->setPrivateParam('new value');
     $this->assertNotEquals($object, $this->memoryCache->load(self::KEY));
 }
Example #2
0
 /**
  * @param string $key
  * @return mixed
  * @throws KeyNotFoundException
  */
 public function load($key)
 {
     if ($this->memoryCache->hasKey($key)) {
         return $this->memoryCache->load($key);
     } else {
         if ($this->fileCache->hasKey($key)) {
             return $this->fileCache->load($key);
         }
     }
     throw new KeyNotFoundException();
 }