Issues

ZF-176: Possible to intervalize timeLife

Description

If configurable variable e.g. intervalizeTimeLife is set to true then It should tune up the expiration time to the nearest time which is (time() mod $lifeTime) == 0. In technical words: <?php if($intervalizeTimeLife) { $expirationTime = time() + (time() % $lifeTime); } else { $expirationTime = time() + $lifeTime; } ?>

Why? Beacause I've a lot of same content (in various forms) at the diferrent pages and I wanna regenerate them at the same time. And if they're generated at the different times dependent on the user input it's impossible in the actual form.

Let me explain: PageA shows ContentA in CacheA PageB shows ConcentA (same data in case of user view e.g. title of photo in article but in another form) in CacheB Imagine this process: 12:30) UserA request PageA -> CacheA is generated and expiration time is set to 13:00 12:40) UserA request PageB -> CacheB is generated and expiration time is set to 13:10 12:50) AdminA makes changes to data but there isn't real connection to the cache so cache can't be deleted. E.g. changes in photo title doesn't reflects to article's cache. 13:00) CacheA expired 13:01) UserB request PageA -> CacheA is regenerated beacause of expiration. 13:09) UserB request PageB -> OLD CacheB is showed. And thats the point. User sees old data where he suggests new data beacause he saw the new data 8 minutes AGO.

With the intervalizeLifeTime to true both caches would be set to 13:00 and user should see same content.

Maybe there should be feature request to have intervalization (the interval between possible expiration dates) different from lifeTime, but I've no idea. <?php $expirationTime = time() + $lifeTime; if($intervalization) { $expirationTime -= $expirationTime % $intervalization; } ?>

Comments

typo

Consider by 0.3.0 and either reject or accept and build the feature. Decision needs to be made.

Decision is going to be made. Right now I'm pondering about what happens at 13:09 and whether it's right or wrong. Is the possibility to "intervalize" lifetime going to solve problems caused by not having a system to invalidate cache records?

For now, you should really invalidate records by tags manually when you change things. For instance, your administrative interface should invalidate all 'thumbnail' records when changing thumbnail details.

For now, you should really invalidate records by tags manually when you change things.

As stated in "12:50) AdminA makes changes to data but there isn't real connection to the cache so cache can't be deleted. E.g. changes in photo title doesn't reflects to article's cache.". There're different records in different tables. It should be much more complex e.g. it should be set of articles from given section. And order of these article should be dependent on priorities which changes in time.

And it means cacheB as list of 3 articles in right column of PageB and cacheA as list of 10 articles in middle column of PageA should be the same. And it's possible with intervalize lifetime even the priorities changes in time because caches are invalidated at the same time.

Changing fix version to 0.6.0.

IMHO, you should use cache tags and clean() method (with CLEANING_MODE_MATCHING_TAG) to do that

Moreover, ZF-457 will help

I propose to close this feature request.

Any other advices ?

no feedback