Closed seroga closed 8 years ago
This behavior is covered in the documentation, but it doesn't explain the implementation details.
The expiration time only sets a maximum time the Item can be considered fresh, not a minimum. Items can be invalidated from the cache before their expiration time for a number of reasons. Stash will also attempt to distribute cache misses to normalize system load. At no point will an Item be considered fresh after the expiration or ttl is reached.
Imagine that you are starting with a clean, empty cache. The first task has to build every cache item requested and specifies some preset ttl, such as 5 minutes. Every 5 minutes, there will be a big rebuild activity spike, as everything expires. Introducing a small variance leads to a more organic distribution of the cache misses over time, eliminating that potentially disruptive activity spike.
Clear , Thanks for explanation
Hi Guys,
I see that during the saving ( \Stash\Item :: executeSet ) you are changing the expiration time by dedacting the randim number between 0 and 15% of cacheTime .
Could you please explain the reason why ?
Thanks, Kind Regards,