缓存配置:app/config/cache.php

 
缓存:
    增加缓存项: Cache::put( 'key', 'value', $Cachetime );
    在缓存中增加一个不存在的缓存项: Cache::add( 'key', 'value', $cachetime );
    检测一个缓存是否存在: Cache::has( 'key' );
    获取缓存项: Cache::get( 'key' );
    在缓存中保存一个永久的缓存项: Cache::forever( 'key', 'value' );
    删除一个缓存项: Cache::forget( 'key' );
    刷新字段中的所有缓存项: Cache::section( 'people' )->flush();
    
 数据库缓存: 

        当使用 database 缓存驱动,您需要建立一张表保存缓存项。下面是一个对这张表的 Schema 声明的例子:

        Schema::create('cache', function($table){
            $table->string('key')->unique();
            $table->text('value');
            $table->integer('expiration');
        });
事件:
    使用类做为监听器
             注册类作为监听器: Event::listen( 'user.login', 'LoginHandler' );
                    默认下会调用 LoginHandler 类里面的 handler 方法
             监听器类:
                    Class LoginHandler {
                            public function handler()
                            {

                            }
                    }
// 调用指定的类方法: Event::listen( 'user.login', 'LoginHandler@xxx' );





 

相关文章:

  • 2021-09-09
  • 2021-12-26
  • 2022-01-23
  • 2021-06-22
  • 2021-08-08
  • 2022-12-23
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2022-01-25
  • 2022-02-02
  • 2022-01-30
  • 2022-01-25
  • 2022-02-15
相关资源
相似解决方案