springuser2014 / wro4j

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

Turn off css and model caching in DEVELOPMENT mode #165

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Because even one second is not short enough when you change .less stylesheet 
and continuously hit refresh in browser waiting while cache is refreshed.

Original issue reported on code.google.com by eum...@gmail.com on 24 Jan 2011 at 6:09

GoogleCodeExporter commented 9 years ago
The cache was turned off also in DEVELOPMENT mode intentionally. 
You have at least 3 ways of achieving the same results:

1) If JMX is enabled you can trigger cache and/or model update through jconsole
2) Set the cacheUpdatePeriod and/or modelUpdatePeriod to 5 seconds in your 
web.xml (@see http://code.google.com/p/wro4j/wiki/GettingStarted)
3) Trigger cache and/or model update through HTTP with a simple GET request:
   a) for cache update - /wro/wroAPI/reloadCache
   b) for model update - /wro/wroAPI/reloadModel
These requests will be processed only in DEVELOPMENT mode.

I'll mark this issue as WON'T FIX, but if you do not agree or have other 
suggersions, please let me know.

Original comment by alex.obj...@gmail.com on 24 Jan 2011 at 7:54

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 24 Jan 2011 at 7:54

GoogleCodeExporter commented 9 years ago
I have an idea which would help to disable cache in development mode. An issue 
for this purpose has been created: 
http://code.google.com/p/wro4j/issues/detail?id=166

Original comment by alex.obj...@gmail.com on 24 Jan 2011 at 9:26

GoogleCodeExporter commented 9 years ago
I think you probably should send "no-cache" headers to the browser in
development mode, and maybe no matter what cache lifetime is
specified. It turned out that cache lifetime of 1 second would be
short enough for comfort development of CSS and JS, but cache headers
make browsers to not refresh their cache on F5 and causes the coder to
wait up to several minutes while the browser cache is refreshed, which
is pain when you fine-tune your css or js and have to switch from IDE
to browser very often

Original comment by eum...@gmail.com on 25 Jan 2011 at 4:32

GoogleCodeExporter commented 9 years ago
That shouldn't be a problem, because besides the no-cache header, the server 
sends ETag header containing a digested hash of the content. That means, that 
if the serverside cache is disabled and you've changed some js or css, the ETag 
will differ and it will force browser to get the latest version. 

Anyway, I'll update the cache headers for DEVELOPMENT mode because it does make 
sense.

Original comment by alex.obj...@gmail.com on 25 Jan 2011 at 10:24