Eloquent cache
Laravel Eloqeunt model auto caching., (*1)
Contents
- Compatibility
-
Installation
- Composer
-
Usage
- Inherit model
- Author
- License
Compatibility
Library |
Version |
Laravel |
5.5 |
Installation
Composer
composer require tarkhov/eloquent-cache
Usage
Inherit model
Start using caching features by inheriting CacheModel
class., (*2)
<?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, (*3)
License
This project is licensed under the MIT License - see the LICENSE
file for details., (*4)