V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lvht
V2EX  ›  PHP

Laravel Eloquent Eloquent 透明缓存

  •  
  •   lvht · Mar 3, 2016 · 3097 views
    This topic created in 3712 days ago, the information mentioned may be changed or developed.

    各位同学,

    安个家技术团队开源了一套 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 replies    2016-03-09 14:50:29 +08:00
    Chestnut
        1
    Chestnut  
       Mar 9, 2016
    支持!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   935 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 23:29 · PVG 07:29 · LAX 16:29 · JFK 19:29
    ♥ Do have faith in what you're doing.