本文整理汇总了PHP中Illuminate\Support\Facades\Cache::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::flush方法的具体用法?PHP Cache::flush怎么用?PHP Cache::flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Cache
的用法示例。
在下文中一共展示了Cache::flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editContent
/**
* Changes the content in About Us page as required
* and returns to the admin's about us edit page.
*
* @param EditAboutUsRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function editContent(EditAboutUsRequest $request)
{
$img = $request->file('bannerImg');
if ($img != null || $img != '') {
$upload_path = public_path() . "/FrontEnd/img/about_us/";
// for more on Laravel upload handling: http://clivern.com/how-to-create-file-upload-with-laravel/
$img->move($upload_path, 'about_us2.jpg');
// File Cache is cleared and rebuilt
// Reason: Sometimes, even though the file has been changed, webpage displays the old file
// even if it doesn't exist anymore. That nonexistant image comes from the file cache which is
// used by Laravel to speedup web page loading speeds.
Cache::flush();
}
if ($request->paragraph != null || $request->paragraph != '') {
$content = $request->paragraph;
$current_description = AboutUs::find(AboutUs::max('id'));
if ($current_description == null) {
$about_us = new AboutUs();
$about_us->description = $content;
$about_us->save();
} else {
$about_us = $current_description;
$about_us->description = $content;
$about_us->save();
}
}
return redirect('admin_about_us')->with('status', 'About Us page was successfully updated.');
}
示例2: clearCache
public function clearCache()
{
Cache::flush();
Logs::add('process', trans('whole::http/controllers.tools_log_1'));
Flash::success(trans('whole::http/controllers.tools_flash_1'));
return redirect()->route('admin.index');
}
示例3: clearCache
public function clearCache()
{
Cache::flush();
Logs::add('process', "Ön Bellek Temizlendi");
Flash::success('Ön Bellek Başarıyla Temizlendi');
return redirect()->route('admin.index');
}
示例4: putAll
/**
* Handle permissions change
*
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function putAll(Request $request)
{
$permissions = Permission::all();
$input = array_keys($request->input('permissions'));
try {
DB::beginTransaction();
$permissions->each(function ($permission) use($input) {
if (in_array($permission->id, $input)) {
$permission->allow = true;
} else {
$permission->allow = false;
}
$permission->save();
});
DB::commit();
flash()->success(trans('permissions.save_success'));
} catch (\Exception $e) {
var_dump($e->getMessage());
die;
flash()->error(trans('permissions.save_error'));
}
try {
Cache::tags(['permissions'])->flush();
} catch (\Exception $e) {
Cache::flush();
}
return redirect()->back();
}
示例5: getClear
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getClear()
{
// Cache::forget('settings');
// Cache::forget('popular_categories');
Cache::flush();
return redirect()->back()->withSuccess('Cache Cleared!');
}
示例6: clearCache
/**
* Clear app cache.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function clearCache()
{
Cache::flush();
Artisan::call('config:clear');
Artisan::call('clear-html');
Notification::success(trans('settings::global.Cache cleared') . '.');
return redirect()->route('admin::index-settings');
}
示例7: __construct
public function __construct()
{
Cache::flush();
//refresh elke keer voor development purpose...
view()->share('euro', function ($number) {
return number_format($number, 2, ',', '.');
});
view()->share('user', \Auth::user());
}
示例8: updateSideBarCache
public static function updateSideBarCache()
{
$categories = Category::all();
$posts = Post::orderBy('updated_at', 'desc')->limit(2)->get();
if (Cache::has('categories') || Cache::has('posts')) {
Cache::flush();
}
Cache::forever('posts', compact('posts'));
Cache::forever('categories', compact('categories'));
}
示例9: flushCaches
public function flushCaches()
{
Cache::flush();
Session::flash('success', 'Les caches ont été effacés avec succès.');
return redirect('admin');
}
示例10: flushCache
/**
* Flush the users cache
*
* @param \App\Models\User $user
*/
public static function flushCache(User $user = null)
{
if ($user && $user->hasRole('admin')) {
Cache::flush(['admin_users']);
}
}
示例11: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$teacher = Teacher::find($id);
if (!$teacher) {
return $this->response->errorNotFound('Teacher not found');
}
$teacher->delete();
// Bad
Cache::flush();
// Better
//Cache::tags('teacher-' . $id)->flush();
}
示例12: clear
/**
* Clears all cache data
*
* @example
* <code>
* //delete all cache
* mw()->cache->clear();
* </code>
* @return boolean
* @package Cache
*/
public function clear()
{
return Cache::flush(true);
}
示例13: flush
public function flush()
{
Cache::flush();
}
示例14: getDeleteFavicon
/**
* Deletes favicon
*
* @return Response
*/
public function getDeleteFavicon()
{
Session::put('settings_tab', 'favicon');
$path = public_path(Settings::getFavicon());
file_exists($path) ? unlink($path) : null;
Settings::where('param', 'favicon')->update(['value' => null]);
Cache::flush('settings');
flash()->success(trans('settings.favicon_deleted'));
return redirect()->back();
}
示例15: wipe
/**
* Flush entire cache.
*
* @author Morten Rugaard <moru@nodes.dk>
* @return bool
*/
public function wipe()
{
return IlluminateCache::flush();
}