예제 #1
0
 /**
  * @param string $identifier the cache content identifier
  * @param mixed $content the content to cache
  * @param integer $cacheLifetime the max. cache lifetime for the content
  * @throws \InvalidArgumentException
  */
 public function __construct($identifier, $content, $cacheLifetime = 60)
 {
     parent::__construct(Messages::SET);
     $this->setIdentifier($identifier)->setContent($content)->setLifetime($cacheLifetime);
 }
예제 #2
0
 /**
  * @covers Brickoo\Component\Storage\Messaging\Message\StorageMessage::getLifetime
  * @covers Brickoo\Component\Storage\Messaging\Message\StorageMessage::setLifetime
  */
 public function testGetLifetimeReturnsParameterValue()
 {
     $lifetime = 60;
     $cacheMessage = new StorageMessage(Messages::GET);
     $cacheMessage->setLifetime($lifetime);
     $this->assertEquals($lifetime, $cacheMessage->getLifetime());
 }
예제 #3
0
 public function __construct()
 {
     parent::__construct(Messages::FLUSH);
 }
예제 #4
0
 /**
  * @param string $identifier
  * @throws \InvalidArgumentException
  */
 public function __construct($identifier)
 {
     parent::__construct(Messages::DELETE);
     $this->setIdentifier($identifier);
 }
 /**
  * @param string $identifier the cache unique identifier
  * @param callable $callback the callback for fresh loading
  * @param array $callbackArguments the callback arguments
  * @param integer $cacheLifetime the max. cache lifetime for the fresh loaded content
  */
 public function __construct($identifier, callable $callback, array $callbackArguments = [], $cacheLifetime = 0)
 {
     parent::__construct(Messages::CALLBACK);
     $this->setIdentifier($identifier)->setLifetime($cacheLifetime)->setCallback($callback)->setCallbackArguments($callbackArguments);
 }