Looking to hire Laravel developers? Try LaraJobs

laravel-cachable maintained by devituz

Description
Simple and dynamic caching trait for Laravel models (Redis compatible)
Author
Last update
2025/10/24 14:05 (dev-master)
License
Links
Downloads
30

Comments
comments powered by Disqus

🚀 Laravel Cachable

LaravelCachable is a simplified, multi-language model caching trait that works with Redis. It automatically caches and purges model data on created, updated, and deleted events.


📦 Installation

composer require devituz/laravel-cachable

Add model

use Cachable;

Example code

$product = Product::find(1);

// 🔹 Save single record to cache
$product->cacheSingle();

// 🔹 Retrieve single record from cache
$cached = Product::getCached(1);

// 🔹 Retrieve all records from cache
$all = Product::allCached();

// 🔹 Clear cache for a record
$product->forgetCache();