jahaziel17 / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

ResourceWatcher invalidates the cache after the first request #886

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Reported by user:

I started debugging the code and I think I see the problem. But first I need to 
tell you that today it's not the 4th call that is first to retrieve the value 
directly from cache but the 3rd. It's changed since yesterday. So the 1st call 
for the resource is taking very long to process, then the 2nd one is much 
shorter but still quite long and every call since the 3rd retrieves the value 
from cache and is almost instant.

The problem is ResourceWatcher, which is invoked AFTER the 1st request for the 
resource when the value is already stored in cache. As it looks like it's 
invoked for the first time, it sees all the resources as new and so invalidates 
the cached value. The 2nd request for the resource sees empty cache and so 
loads the resouces again, then storing it in the cache. As there is no 
ResourceWatcher invoked this time (BTW I've set resourceWatcherUpdatePeriod to 
600 seconds) the 3rd call properly retrieves the value from cache.

Resource: https://groups.google.com/forum/#!topic/wro4j/Li3nyc9BeMo

Original issue reported on code.google.com by alex.obj...@gmail.com on 17 Jul 2014 at 2:29

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 25 Sep 2014 at 8:25