tarkhov / eloquent-cache
Laravel Eloquent model cache.
v0.1.0
2018-03-12 03:05 UTC
Requires
- php: >=7.0
- illuminate/database: ^5.5
README
Laravel Eloqeunt model auto caching.
Contents
Compatibility
Library | Version |
---|---|
Laravel | 5.5 |
Installation
Composer
composer require tarkhov/eloquent-cache
Usage
Inherit model
Start using caching features by inheriting CacheModel
class.
<?php namespace App; use EloquentCache\Database\Eloquent\CacheModel; class Post extends CacheModel { protected $fillable = [ 'category_id', 'title', 'description', ]; public function category() { return $this->belongsTo('App\Category', 'category_id'); } }
<?php namespace App; use EloquentCache\Database\Eloquent\CacheModel; class Category extends CacheModel { protected $cacheTags = ['category']; protected $fillable = [ 'title', 'description', ]; }
Author
Alexander Tarkhov
License
This project is licensed under the MIT License - see the LICENSE
file for details.