本文整理汇总了PHP中Illuminate\Support\Facades\Cache::forget方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::forget方法的具体用法?PHP Cache::forget怎么用?PHP Cache::forget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Cache
的用法示例。
在下文中一共展示了Cache::forget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $load
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Setting $setting)
{
Cache::forget('settings');
$setting->updateSettings($request, ['site_title', 'site_tags', 'site_description', 'allow_registration', 'pagination_num']);
flash()->success(trans('all.entry_updated'));
return redirect(action('Admin\\SettingsController@index'));
}
示例2: render
public function render($format = 'atom', $cache = FALSE, $cacheTime = 3600)
{
$channel = $this->channel;
$channel->pubdate = $this->formatDate($this->channel->pubdate, $format);
$items = $this->items;
foreach ($items as $item) {
$item->pubdate = $this->formatDate($item->pubdate, $format);
}
if ($format == 'atom') {
$this->content_type = 'application/atom+xml';
} else {
$this->content_type = 'application/rss+xml';
}
if ($cache == TRUE && Cache::has('feed-' . $format)) {
return response()->view('feed::' . $format, Cache::get('feed-' . $format))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
} elseif ($cache == TRUE) {
Cache::put('feed-' . $format, compact('channel', 'items'), $cacheTime);
return response()->view('feed::' . $format, compact('channel', 'items'))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
} elseif ($cache == FALSE && Cache::has('feed-' . $format)) {
Cache::forget('feed-' . $format);
return response()->view('feed::' . $format, compact('channel', 'items'))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
} else {
return response()->view('feed::' . $format, compact('channel', 'items'))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
}
}
示例3: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if ($this->option('tracks') === 'all') {
// Get all cacheable track files
$trackFiles = TrackFile::where('is_cacheable', true)->with('track.album')->get();
} else {
// Get all expired track files
$trackFiles = TrackFile::where('is_cacheable', true)->where('expires_at', '<=', Carbon::now())->with('track.album')->get();
}
// Delete above track files
if (count($trackFiles) === 0) {
$this->info('No tracks found. Exiting.');
} else {
if ($this->option('force') || $this->confirm(count($trackFiles) . ' cacheable track files found. Proceed to delete their files if they exist? [y|N]', false)) {
$count = 0;
foreach ($trackFiles as $trackFile) {
// Set expiration to null (so can be re-cached upon request)
$trackFile->expires_at = null;
$trackFile->update();
// Delete file if exists
if (File::exists($trackFile->getFile())) {
$count++;
File::delete($trackFile->getFile());
$this->info('Deleted ' . $trackFile->getFile());
}
// Remove the cached file size for the album
Cache::forget($trackFile->track->album->getCacheKey('filesize-' . $trackFile->format));
}
$this->info($count . ' files deleted. Deletion complete. Exiting.');
} else {
$this->info('Deletion cancelled. Exiting.');
}
}
}
示例4: unlink
public function unlink()
{
if (Cache::has($this->name)) {
return Cache::forget($this->name);
}
return FALSE;
}
示例5: boot
public static function boot()
{
parent::boot();
Webhook::creating(function ($results) {
Cache::forget('webhooks');
});
}
示例6: updateApproveStatus
protected function updateApproveStatus()
{
Cache::forget($this->qdn->slug);
$status['status'] = $this->status() ? 'Q.a. Verification' : 'Incomplete Approval';
$this->qdn->closure()->update($status);
return $this;
}
示例7: handle
/**
* @inheritdoc
*/
public function handle($arguments)
{
if (!Cache::has('site-' . $arguments)) {
$this->replyWithMessage("Não foi encontrado nenhum site com esse argumento.");
return;
}
$site = Cache::get('site-' . $arguments);
// Validate if the URL isn't on the database yet
if (Site::where('url', '=', $site)->first() != null) {
$this->replyWithMessage("O site {$site} já se encontra na base de dados.");
return;
}
$site_obj = new Site();
$site_obj->url = $site;
$site_obj->save();
$this->replyWithMessage($site . " foi adicionado à base de dados.", true);
// Notify the sitesbloqueados.pt about the new site
$url = 'https://sitesbloqueados.pt/wp-json/ahoy/refresh';
$cmd = "curl -X GET -H 'Content-Type: application/json'";
$cmd .= " " . "'" . $url . "'";
$cmd .= " > /dev/null 2>&1 &";
exec($cmd, $output);
// Flush the PAC cache
Cache::tags(['generate_pac'])->flush();
// Remove the cache
Cache::forget('site-' . $arguments);
Cache::forget('site-list');
}
示例8: check
/**
* Check if the api key is passed its limit, while also adding or updating cache
*
* @param ApiKey $apiKey - The api key in question
* @return boolean - Is the api key being rate limited
*/
public static function check(\ApiKey $apiKey)
{
$public_key = $apiKey->public_key;
$accessLevel = $apiKey->accessLevel;
// check cache for the key, create is doesn't exist
if (!Cache::has($public_key)) {
self::generateCache($public_key, $accessLevel);
}
// get the cache
$cache = json_decode(Cache::get($public_key));
// create timestamp instances for when the cache was created and now
$cachedTimestamp = Carbon::createFromFormat('Y-m-d H:i:s', $cache->expires_at);
$timestamp = Carbon::now();
// check if cache has expired, if so create cache
if ($timestamp->gt($cachedTimestamp)) {
Cache::forget($public_key);
self::generateCache($public_key, $accessLevel);
$cache = json_decode(Cache::get($public_key));
}
// check if api key is over request limit
if ($cache->remaining <= 0) {
return false;
}
// decrement remaining requests by 1
$cache->remaining -= 1;
// update cache
Cache::put($apiKey->public_key, json_encode($cache), 0);
return true;
}
示例9: onKeysFlush
public function onKeysFlush()
{
$keys = $this->controller->getDefinitionOption('cache.keys', array());
foreach ($keys as $key) {
Cache::forget($key);
}
}
示例10: boot
public static function boot()
{
parent::boot();
static::saved(function () {
Cache::forget(static::HOME_CACHE_KEY);
return true;
});
}
示例11: logout
public function logout()
{
Cache::forget('role_id');
Cache::forget('this_user');
Logs::add('process', 'Kullanıcı Çıkış Yaptı');
Auth::logout();
return redirect()->route('master_page');
}
示例12: getThemeColorChange
/**
* Admin Theme Color Change
*
* @param Request $request
* @return \Illuminate\Http\Response
*/
public function getThemeColorChange(Request $request)
{
if (Cache::has('theme_color')) {
Cache::forget('theme_color');
}
Cache::forever('theme_color', $request->all());
return response()->json(['result' => true]);
}
示例13: logout
public function logout()
{
Cache::forget('role_id');
Cache::forget('this_user');
Logs::add('process', trans('whole::http/controllers.auth_log_3'));
Auth::logout();
return redirect()->route('master_page');
}
示例14: bootPermissionTrait
/**
* bootPermissionTrait.
*
* @method bootPermissionTrait
*/
public static function bootPermissionTrait()
{
static::saved(function ($model) {
Cache::forget(static::cacheKey());
}, 99);
static::deleted(function () {
Cache::forget(static::cacheKey());
}, 99);
}
示例15: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @param Request $request
* @return Response
*/
public function update($id, Request $request)
{
$this->authorize('authorizeAccess', 'category_edit');
$this->fieldCategory->where('id', '=', $id)->update(['name_ar' => $request->input('name_ar'), 'name_en' => $request->input('name_en')]);
$fieldsCategories = $this->fieldCategory->all();
Cache::forget('fieldsCategories');
Cache::forever('fieldsCategories', $fieldsCategories);
return redirect()->back()->with('success', trans('messages.success.updated'));
}