本文整理汇总了PHP中Illuminate\Cache\Repository::forget方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::forget方法的具体用法?PHP Repository::forget怎么用?PHP Repository::forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Cache\Repository
的用法示例。
在下文中一共展示了Repository::forget方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
// New and changed keys
$changed = array_diff_assoc($this->data, $this->original);
$insertValues = array();
foreach ($changed as $name => $value) {
if (!array_key_exists($name, $this->original)) {
$insertValues[] = array('conf_name' => $name, 'conf_value' => $value);
unset($changed[$name]);
}
}
if (!empty($insertValues)) {
$this->database->table('config')->insert($insertValues);
}
foreach ($changed as $name => $value) {
$this->database->table('config')->where('conf_name', '=', $name)->update(array('conf_value' => $value));
}
// Deleted keys
$deletedKeys = array_keys(array_diff_key($this->original, $this->data));
if (!empty($deletedKeys)) {
$this->database->table('config')->whereIn('conf_name', $deletedKeys)->delete();
}
// No need to cache old values anymore
$this->original = $this->data;
// Delete the cache so that it will be regenerated on the next request
$this->cache->forget('fluxbb.config');
}
示例2: testShouldReturnIncrementalValues
public function testShouldReturnIncrementalValues()
{
$this->repository->increment('memcached-testing');
$this->assertSame(1, $this->repository->get('memcached-testing'));
$this->repository->increment('memcached-testing', 100);
$this->assertSame(101, $this->repository->get('memcached-testing'));
$this->repository->decrement('memcached-testing', 100);
$this->assertSame(1, $this->repository->get('memcached-testing'));
$this->repository->decrement('memcached-testing', 100);
$this->assertSame(0, $this->repository->get('memcached-testing'));
$this->repository->forget('memcached-testing');
$this->repository->decrement('memcached-testing', 100);
$this->assertSame(0, $this->repository->get('memcached-testing'));
$this->repository->forget('memcached-testing');
}
示例3: clear
/**
* clear all caches
*/
public function clear()
{
$this->cache->forget(self::INDEX_KEY);
foreach ($this->cache->get(self::CACHE_KEYS_KEY) as $key) {
$this->cache->forget($key);
}
$this->cache->forget(self::CACHE_KEYS_KEY);
}
示例4: flush
/**
* Flush the cache for this Model Object instance
*
* @param Model $model
* @return void
*/
public function flush(Model $model)
{
// Assemble Cache Keys
$keys[] = $this->resourceName . '.hash.' . $model->hash;
$keys[] = $this->resourceName . '.id.' . $model->id;
// Some keys will not be available on all models
$referenceColumn = $this->referenceIdColumnName();
if ($this->model->isFillable($referenceColumn)) {
$keys[] = $this->resourceName . '.' . $referenceColumn . '.' . $model->{$referenceColumn};
}
// Clear the cache for the given keys
foreach ($keys as $key) {
$this->cache->forget($key);
}
}
示例5: handle
/**
* Handle the form.
*
* @param Repository $cache
* @param Redirector $redirect
* @param $key
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handle(Repository $cache, Redirector $redirect, $key)
{
$parameters = $cache->get('form::' . $key);
/* @var FormCriteria $criteria */
$criteria = $this->dispatch(new GetFormCriteria($parameters));
/* @var FormBuilder $builder */
$builder = $criteria->build();
$response = $builder->build()->post()->getFormResponse();
$builder->flash();
$cache->forget('form::' . $key);
if ($response && $response->getStatusCode() !== 200) {
return $response;
}
if ($builder->isAjax()) {
return $builder->getFormResponse();
}
if ($builder->hasFormErrors()) {
return $redirect->back();
}
return $response ?: $redirect->back();
}
示例6: forget
/**
* Remove an item from the cache.
*
* @param string $key
* @return bool
* @static
*/
public static function forget($key)
{
return \Illuminate\Cache\Repository::forget($key);
}
示例7: forget
/**
* Remove an item from the cache.
*
* @param mixed $key
* @return bool
*/
public function forget($key)
{
if (is_array($key)) {
return $this->forgetMany($key);
}
return parent::forget($key);
}
示例8: forget
/**
* Forget settings cache.
*
* @return bool
*/
public function forget()
{
return $this->cache->forget(self::CACHE_KEY);
}
示例9: destroy
/**
* {@inheritDoc}
*/
public function destroy($sessionId)
{
return $this->cache->forget($sessionId);
}
示例10: forgetCodeFromCache
/**
* 删除验证码
* @param string $mobile
* @param string $bag
*/
public function forgetCodeFromCache($mobile, $bag)
{
$key = $this->getCacheKey($mobile, $bag);
return $this->store->forget($key);
}
示例11: flush
/**
* Flushes traces of records related to the provided keywords, otherwise proceeds to regular flush() method.
*/
public function flush()
{
if (!empty($this->keywords)) {
$flushedKeys = $this->forgetKeywordIndex($this->keywords);
$affectedKeywords = $this->forgetInverseIndex($flushedKeys);
foreach ($flushedKeys as $flushedKey) {
// Set all affected keywords as old keywords and request
// empty new keywords to remove the flushed key from other indices as well.
$this->determineKeywordsState($flushedKey, [], $affectedKeywords);
$this->updateKeywordIndex($flushedKey);
parent::forget($flushedKey);
}
} else {
parent::flush();
}
if (!$this->operatingOnKeywords()) {
$this->resetCurrentKeywords();
}
}
示例12: forget
/**
* Remove an item from the cache.
*
* @param string $key
*
* @return bool
*/
public function forget($key)
{
return $this->enabled ? $this->cache->forget($key) : false;
}
示例13: deleteCachedSiteInstanceRoutes
/**
* deleteCachedSiteInstanceRoutes
*
* @param string $siteKey key of site
*
* @return void
*/
public function deleteCachedSiteInstanceRoutes($siteKey)
{
$keyString = $this->getSiteCacheKeyString($siteKey);
$this->cache->forget($keyString);
}