/** * Stores a value into the cache. * * The $value argument can be any item that can be serialized by PHP, * although the method of serialization is left up to the Implementing * Library. * * The $ttl can be defined in a number of ways. As an integer or * DateInverval object the argument defines how long before the cache should * expire. As a DateTime object the argument defines the actual expiration * time of the object. Implementations are allowed to use a lower time than * passed, but should not use a longer one. * * If no $ttl is passed then the item can be stored indefinitely or a * default value can be set by the Implementing Library. * * Returns true if the item was successfully stored. * * @param mixed $value * @param int|DateInterval|DateTime $ttl * * @return bool */ public function set($value, $ttl = null) { $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext(); $cleaningFactor = $context->get(tubepress_api_const_options_names_Cache::CACHE_CLEAN_FACTOR); $cleaningFactor = intval($cleaningFactor); /** * Handle cleaning factor. */ if ($cleaningFactor > 0 && rand(1, $cleaningFactor) === 1) { $this->_parentCache->flush(); } if ($ttl === null) { $ttl = intval($context->get(tubepress_api_const_options_names_Cache::CACHE_LIFETIME_SECONDS)); } return $this->_delegate->set($value, $ttl); }
/** * {@inheritdoc} */ public function setPool(ehough_stash_interfaces_PoolInterface $pool) { $this->pool = $pool; $this->driver = $pool->getDriver(); }
public function setLogger($logger) { $this->_delegate->setLogger($logger); }