Support the ongoing development of Laravel.io →
Configuration Cache Architecture
Last updated 2 years ago.
0

I'd really love to know that too. :) Any tips / articles etc would be appreciated

0

Maintaining a query cache is fairly simple if you use a cache storage driver supporting tags (like Redis or Memcached).

If you use Eloquent, each model get his own tag (like the class name for example), and on every model saved event, you just flush the cache for that tag.

When storing a query in the cache, you just assign the tag of every model that has influence on the query's output to the cache object. So every time a model gets saved, all related caches get flushed.

  • You can also create tags for specific models (like Class#id), so you can flush a cache only when a specific model gets changed.

  • You can append a page number to the cache key to keep paginated caches.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

shez1983 shez1983 Joined 31 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.