A Special Caching Strategy

Hello! I would like to discuss a special caching strategy.

Sometimes you have some data which may not be updated immediately. That is it may be updated with some delay. Let’s say we have a news block on our site. You decide to cache this data. You specify a database dependency for that data e. g.


SELECT MAX(updated_at) from NEWS

The problem is that this DB query will be executed on each and every page load.

What I propose is to add a caching logic which will check the caching condition ONLY WHEN the cache duration elapsed. This is not how cache works now. Currently the cache will check BOTH duration and dependency.

I think my proposal may be useful in cases when you have some data that may be kept a bit outdated and when you want to lower the DB load.

This strategy may be implemented as a cache parameter. This even will not break the BC.

Thank you!