当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache::forget方法代码示例

本文整理汇总了PHP中Cache::forget方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::forget方法的具体用法?PHP Cache::forget怎么用?PHP Cache::forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cache的用法示例。


在下文中一共展示了Cache::forget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRemove

 public function testRemove()
 {
     $this->cache->set("foo", "bar");
     $this->assertEquals("bar", $this->cache->get("foo"));
     $this->cache->forget("foo");
     $this->assertNull($this->cache->get("foo"));
 }
开发者ID:dtkahl,项目名称:php-file-cache,代码行数:7,代码来源:FileCacheTest.php

示例2: removeCache

 /**
  * Removes Cache for given entity
  * @param null $entity
  */
 public function removeCache($entity = null)
 {
     if ($entity === null) {
         $entity = $this->entity;
     }
     $this->cache->forget('etag-' . $entity);
     $this->cache->forget('content-' . $entity);
 }
开发者ID:ipunkt,项目名称:laravel-route-cache,代码行数:12,代码来源:RouteCache.php

示例3: returnRoutes

 public static function returnRoutes($prefix = null)
 {
     $dics_for_cache = ['projects', 'types'];
     foreach ($dics_for_cache as $dic_name) {
         ## Refresh dics cache
         #Cache::forget('dic_' . $dic_name);
         $dic_[$dic_name] = Cache::get('dic_' . $dic_name);
         if (!$dic_[$dic_name]) {
             Cache::forget('dic_' . $dic_name);
             $dic_[$dic_name] = Dic::valuesBySlug($dic_name, function ($query) {
                 $query->orderBy('lft', 'ASC');
             }, ['allfields', 'alltextfields'], true, true, true);
             #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); #die;
             $dic_[$dic_name] = DicLib::loadImages($dic_[$dic_name], ['avatar', 'image', 'logo', 'photo', 'header_img']);
             #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); #die;
             Cache::add('dic_' . $dic_name, $dic_[$dic_name], self::$global_cache_min);
         }
         View::share('dic_' . $dic_name, $dic_[$dic_name]);
         #Helper::d($dic_name); Helper::ta($dic_{$dic_name});
     }
     #Helper::tad($dic_{'city'});
     #die;
     Route::group(array('prefix' => '{lang}'), function () {
         Route::any('/project/{slug}', array('as' => 'app.project', 'uses' => __CLASS__ . '@appProject'));
         #Route::any('/ajax/send-message', array('as' => 'ajax.send-message', 'uses' => __CLASS__.'@postSendMessage'));
         #Route::any('/ajax/some-action', array('as' => 'ajax.some-action', 'uses' => __CLASS__.'@postSomeAction'));
     });
     Route::group(array(), function () {
         #Route::any('/ajax/send-message', array('as' => 'ajax.send-message', 'uses' => __CLASS__.'@postSendMessage'));
         #Route::any('/ajax/some-action', array('as' => 'ajax.some-action', 'uses' => __CLASS__.'@postSomeAction'));
     });
 }
开发者ID:Grapheme,项目名称:dada,代码行数:32,代码来源:application.controller.php

示例4: generateSitemap

 public static function generateSitemap($reGenerate = false)
 {
     // create new sitemap object
     $sitemap = App::make("sitemap");
     $sitemap->setCache('laravel.sitemap', 3600);
     if ($reGenerate) {
         Cache::forget($sitemap->model->getCacheKey());
     }
     // check if there is cached sitemap and build new only if is not
     if (!$sitemap->isCached()) {
         // add item to the sitemap (url, date, priority, freq)
         $sitemap->add(URL::to('/'), null, '1.0', 'daily');
         $categories = Category::get();
         foreach ($categories as $category) {
             $sitemap->add(URL::route('category', [$category->slug]), null, '1.0', 'daily');
         }
         // get all lists from db
         $lists = ViralList::orderBy('created_at', 'desc')->get();
         // add every post to the sitemap
         foreach ($lists as $list) {
             $sitemap->add(ListHelpers::viewListUrl($list), $list->updated_at, '1.0', 'monthly');
         }
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     return $sitemap->render('xml');
 }
开发者ID:ramialcheikh,项目名称:onepathnetwork,代码行数:26,代码来源:SitemapController.php

示例5: get_logout

 public function get_logout()
 {
     $user_id = Auth::user()->id;
     Cache::forget($user_id . 'modules');
     Auth::logout();
     return Redirect::to_action('users@login');
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:7,代码来源:users.php

示例6: clearAttributeCache

 protected static function clearAttributeCache($model)
 {
     foreach ($model->appends as $attribute) {
         $cacheItem = get_class($model) . $model->id . $attribute;
         \Cache::forget($cacheItem);
     }
 }
开发者ID:ukley,项目名称:laravel-forum,代码行数:7,代码来源:AbstractForumBaseModel.php

示例7: update

 public function update($model, $input)
 {
     if ($this->cacheEnabled) {
         \Cache::forget($this->getLocaleCacheKey($model->locale));
     }
     parent::update($model, $input);
 }
开发者ID:ykusakabe,项目名称:laravel-51-boilerplate,代码行数:7,代码来源:SiteConfigurationRepository.php

示例8: update

 public function update()
 {
     define('STDIN', fopen("php://stdin", "r"));
     Artisan::call("paperwork:update", ['--quiet' => true]);
     Cache::forget('paperwork.commitInfo');
     return PaperworkHelpers::apiResponse(PaperworkHelpers::STATUS_SUCCESS, array());
 }
开发者ID:folkevil,项目名称:paperwork,代码行数:7,代码来源:SetupController.php

示例9: boot

 public function boot()
 {
     $postRepository = $this->app->make('App\\Repositories\\PostRepository');
     $this->app['events']->listen('user.avatar', function ($user, $image) use($postRepository) {
         if ($user->fully_started) {
             $postRepository->add(['content_type' => 'auto-post', 'type_content' => ['type' => 'change-avatar', 'avatar' => $image], 'privacy' => 1, 'type' => 'user-timeline']);
         }
     });
     $this->app['events']->listen('add-album-photos', function ($id, $photos) use($postRepository) {
         $albumRepository = $this->app->make('App\\Repositories\\PhotoAlbumRepository');
         $album = $albumRepository->get($id);
         $postRepository->add(['content_type' => 'auto-post', 'type_content' => ['type' => 'add-photos', 'photos' => $photos, 'photo-count' => count($photos), 'album' => $album], 'privacy' => 1, 'type' => 'user-timeline']);
     });
     $this->app['events']->listen('like.add', function ($userid, $type, $typeId) use($postRepository) {
         if ($type == 'page') {
             if (\Auth::check()) {
                 $page = app('App\\Repositories\\EventRepository')->get($typeId);
                 $postRepository->add(['content_type' => 'auto-post', 'type_content' => ['type' => 'like-page', 'page' => $page], 'privacy' => 1, 'type' => 'user-timeline', 'auto_like_id' => 'page-' . $page->id]);
                 \Cache::forget('page-suggestions-' . \Auth::user()->id);
             }
         } elseif ($type == 'post') {
             $post = $postRepository->findById($typeId);
             $post->touch();
             //method to update this post
             \Cache::forget('post-' . $post->id);
         }
     });
 }
开发者ID:adamendvy89,项目名称:intifadah,代码行数:28,代码来源:PostServiceProvider.php

示例10: cache

 /**
  * Caches a model
  * 
  * @param  string   $model      The name of the model
  * @param  string   $keyPart    The key to use to cache the model (e.g. primary key)
  * @param  \App\LaravelRestCms\BaseModel $data   The model instance
  * @return string
  */
 public static function cache($model, $keyPart, $data)
 {
     $key = static::getCacheKey($model, $keyPart);
     \Cache::forget($key);
     \Cache::put($key, $data, static::$cacheTime);
     return $model;
 }
开发者ID:ddimaria,项目名称:Laravel-REST-CMS,代码行数:15,代码来源:CacheTrait.php

示例11: save

 public function save($id, $request)
 {
     $notifications = $request->get('notifications');
     foreach ($notifications as $notification) {
         if ($notification['id']) {
             $model = $this->model->find($notification['id']);
             if (isset($notification['remove'])) {
                 $model->delete();
                 continue;
             }
             $model->type = $notification['type'];
             $model->data = $notification['data'];
             $model->time = $notification['time'];
             $model->msg = $notification['msg'];
             $model->save();
         } else {
             if (isset($notification['remove'])) {
                 continue;
             }
             $data = $notification + ['channel_id' => $id];
             $this->model->create($data);
         }
     }
     $key = \Config::get('site.cacheChannelsWithNotifications');
     \Cache::forget($key);
 }
开发者ID:jerryamatya,项目名称:broadcaster,代码行数:26,代码来源:NotificationsServiceProvider.php

示例12: onDeleteRowResponse

 public function onDeleteRowResponse(array &$response)
 {
     $this->removeTemplate($response['values']['ident']);
     $def = $this->controller->getDefinition();
     EventsBackend::log(array('ident' => $def['db']['table'] . '_delete', 'object_table' => $def['db']['table'], 'object_id' => Input::get('id')));
     Cache::forget('settings');
 }
开发者ID:OlesKashchenko,项目名称:SkillsProject2,代码行数:7,代码来源:EmailsTableHandler.php

示例13: set

 /**
  * Store setting
  *
  * @param $key
  * @param $value
  * @return bool
  */
 public function set($key, $value)
 {
     /**
      * Setup cache key
      */
     $cacheKey = 'setting_' . md5($key);
     /**
      * Fetch from database
      */
     $setting = Setting::where('key', '=', $key)->first();
     /**
      * If nothing was found, create a new object
      */
     if (!is_object($setting)) {
         $setting = new Setting();
     }
     /**
      * Set the values
      */
     $setting->setKey($key)->setValue($value)->save();
     /**
      * Expire the cache
      */
     \Cache::forget($cacheKey);
     return true;
 }
开发者ID:codepeak,项目名称:dsettings,代码行数:33,代码来源:DSetting.php

示例14: clearSession

 /**
  *  Clear user data in session.
  */
 function clearSession()
 {
     \Cache::forget(session()->pull('PHPSESSID'));
     session()->forget('COOKIE');
     session()->forget('courseLists');
     session()->forget('courseListsContent');
 }
开发者ID:BePsvPT,项目名称:EcourseLite,代码行数:10,代码来源:helpers.php

示例15: Check_User_Cart

function Check_User_Cart()
{
    $Identifier = '';
    if (!Sentry::check()) {
        return false;
    } else {
        $Identifier = Sentry::user()->id;
        if (Cookie::has('Anon_Cart_Extension')) {
            $AnonIdentifier = Cookie::get('Anon_Cart_Extension');
            $dataAnon = Cache::get('user_cart.' . $AnonIdentifier);
            if (Cache::has('user_cart.' . $Identifier)) {
                $dataUser = Cache::get('user_cart.' . $Identifier);
                if ($dataAnon != null && $dataUser != null) {
                    foreach ($dataAnon as $key => $value) {
                        if (!isset($dataUser[$key])) {
                            $dataUser[$key] = $value;
                        }
                    }
                    Cache::forever('user_cart.' . $Identifier, $dataUser);
                    Cache::forget('user_cart.' . $AnonIdentifier);
                }
            } else {
                if ($dataAnon != null) {
                    Cache::forever('user_cart.' . $Identifier, $dataAnon);
                    Cache::forget('user_cart.' . $AnonIdentifier);
                }
            }
        }
    }
}
开发者ID:TahsinGokalp,项目名称:L3-Eticaret,代码行数:30,代码来源:helpers.php


注:本文中的Cache::forget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。