Exemplo n.º 1
0
 /**
  * 缓存系统静态配置
  * 操作SystemOption模型
  *
  * @return void
  */
 public static function cacheStatic()
 {
     $system_options = SystemOption::all();
     foreach ($system_options as $so) {
         Cache::forever($so['name'], $so['value']);
         //file与database驱动的缓存不支持缓存标签
     }
 }
Exemplo n.º 2
0
 /**
  * 缓存系统静态配置
  * 操作SystemOption模型
  *
  * @return void
  */
 public static function cacheStatic()
 {
     $system_options = SystemOption::all();
     foreach ($system_options as $so) {
         if (Config::get('cache.driver') === 'memcached') {
             //建议上memcached缓存
             Cache::tags('system', 'static')->forever($so['name'], $so['value']);
             //系统静态配置很少会发生改变,因此建议永久储存该缓存
         } else {
             Cache::forever($so['name'], $so['value']);
             //file与database驱动的缓存不支持缓存标签
         }
     }
 }