本文整理汇总了PHP中Zend\Cache\Storage\Adapter\AbstractAdapter::removeItem方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractAdapter::removeItem方法的具体用法?PHP AbstractAdapter::removeItem怎么用?PHP AbstractAdapter::removeItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Cache\Storage\Adapter\AbstractAdapter
的用法示例。
在下文中一共展示了AbstractAdapter::removeItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manageAction
/**
* All a user to add and update a feed in the application
*
* @return ViewModel
*/
public function manageAction()
{
$formManager = $this->serviceLocator->get('FormElementManager');
$form = $formManager->get('BabyMonitor\\Forms\\ManageRecordForm');
$feedId = (int) $this->params()->fromRoute('id');
if ($this->getRequest()->isGet()) {
if (!empty($feedId)) {
if ($feed = $this->_feedTable->fetchById($feedId)) {
$form->setData($feed->getArrayCopy());
} else {
$this->flashMessenger()->addInfoMessage('Unable to find that feed. Perhaps a new one?');
return $this->redirect()->toRoute(self::DEFAULT_ROUTE, array('action' => 'manage'));
}
}
}
if ($this->getRequest()->isPost()) {
$form->setData($this->getRequest()->getPost());
if ($form->isValid()) {
$feed = new FeedModel();
$feed->exchangeArray($form->getData());
$this->_feedTable->save($feed);
if (!is_null($this->_cache)) {
$this->_cache->removeItem(self::KEY_ALL_RESULTS);
}
$this->getEventManager()->trigger('Feed.Modify', $this, array('feedData' => $feed));
return $this->redirect()->toRoute(self::DEFAULT_ROUTE, array());
}
}
return new ViewModel(array('form' => $form, 'cancelTitle' => $feedId ? "Don't update the record" : "Don't create the record", 'messages' => array('info' => $this->flashMessenger()->hasInfoMessages())));
}
示例2: removeItem
/**
* Remove an item.
*
* @param string $cacheId
*
* @return bool
*/
public function removeItem($cacheId)
{
$cacheId = $this->normalizeKey($cacheId);
try {
return $this->cache->removeItem($cacheId);
} catch (ZendException\ExceptionInterface $ex) {
return false;
}
}
示例3: clearItem
/**
* Remove an item from the cache
* @param string $key
* @return boolean
*/
public function clearItem($key)
{
//check if caching is enabled
$arr_config = $this->getServiceLocator()->get("config");
if ($arr_config["front_end_application_config"]["cache_enabled"] == FALSE) {
return FALSE;
}
//end if
//adjust key
$key = $this->setIdentifier($key);
$this->storageFactory->removeItem($key);
}
示例4: removeItem
/**
* Remove an item.
*
* @param string $key
* @return bool
* @throws Exception\ExceptionInterface
*
* @triggers removeItem.pre(PreEvent)
* @triggers removeItem.post(PostEvent)
* @triggers removeItem.exception(ExceptionEvent)
*/
public function removeItem($key)
{
$options = $this->getOptions();
if ($options->getWritable() && $options->getClearStatCache()) {
clearstatcache();
}
return parent::removeItem($key);
}
示例5: removeItem
/**
* Remove an item.
*
* Options:
* - namespace <string> optional
* - The namespace to use (Default: namespace of object)
* - ignore_missing_items <boolean> optional
* - Throw exception on missing item
*
* @param string $key
* @param array $options
* @return boolean
* @throws Exception\ExceptionInterface
*
* @triggers removeItem.pre(PreEvent)
* @triggers removeItem.post(PostEvent)
* @triggers removeItem.exception(ExceptionEvent)
*/
public function removeItem($key, array $options = array())
{
$baseOptions = $this->getOptions();
if ($baseOptions->getWritable() && $baseOptions->getClearStatCache()) {
clearstatcache();
}
return parent::removeItem($key, $options);
}