V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lvht
V2EX  ›  PHP

Laravel Eloquent Eloquent 透明缓存

  •  
  •   lvht · 2016-03-03 10:09:03 +08:00 · 2446 次点击
    这是一个创建于 2982 天前的主题,其中的信息可能已经有所发展或是发生改变。

    各位同学,

    安个家技术团队开源了一套 Eloquent 模开的 Redis 缓存项目Pea。我们已经在生产环境大量使用,欢迎大家测试评估,更欢迎提交issuepull request

    特色

    • 行级缓存
    • 表级缓存
    • 自动过期

    更多细节参考wiki

    安装

    composer require angejia/pea:dev-master
    

    使用

    config/app.php中添加Angejia\Pea\ServiceProvider,然后使用Angejia\Pea\Model替换Illuminate\Database\Eloquent\Model。 最后在模型中设置protected属性$needCachetrue即可开启缓存支持。

    class UserModel extends \Angejia\Pea\Model
    {
        protected $needCache = true;
    }
    
    1 条回复    2016-03-09 14:50:29 +08:00
    Chestnut
        1
    Chestnut  
       2016-03-09 14:50:29 +08:00
    支持!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   798 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:20 · PVG 06:20 · LAX 15:20 · JFK 18:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.