amelia/rememberable
Amelia Rememberable adds query caching to Laravel's Eloquent ORM, letting you cache expensive database queries and reuse results with a simple trait. Cut repeated queries, speed up slow pages, and keep your models fast with minimal code changes.
composer require amelia/rememberable:3.0.0-beta1. The release note does not state supported Laravel/PHP versions, so re-check Composer constraints instead of carrying forward the old Laravel 5 assumption.remember()/dontRemember() still exist.class CachedBaseModel extends Model
{
use Amelia\Rememberable\Rememberable;
}
class Product extends CachedBaseModel
{
}
$products = Product::where('active', 1)->orderBy('name')->get();
Run it twice in php artisan tinker with DB::listen(fn ($q) => dump($q->sql)). The second call should emit no SQL. Do not roll out to a global base model until you can prove hits, misses, and invalidation.
saved/deleted observers or a repository layer to forget affected keys, flush tags, or bump a version segment embedded in the key.with() before get()/paginate() so relations are part of the cached payload rather than firing uncached on every request.array cache, flush between tests, and assert with DB::enableQueryLog() that cached reads emit zero queries and writes invalidate as expected.The release note says “automatic query caching” but does not document method names, config keys, or invalidation behavior. Confirm the v3 API against source before standardizing it.
remember() API was removed or retained.DB::afterCommit or model events) so rolled-back rows do not remain cached.CACHE_DRIVER per environment; file and database stores may throw when tags are used.DB::listen, Redis INFO, or a temporary zero TTL. If you cannot demonstrate a cache hit, assume the query is uncached or the key is changing.watson/rememberable or a small first-party trait. For a one-line release note, budget time for source review before production adoption.How can I help you explore Laravel packages today?