0

In my current project I'm getting some html templates (for a single page interface web app) via ajax. Now I'm interested if the caching works as expected - so I would like to enable caching for those templates. Does it make sense to enable caching just like on the production environment.

In my opinion I would make no difference between development and production environment.

As I see the pros/cons:

PROS:

  • no extra testing if it works in production environment
  • no need for different configuration on dev/production environments

CONS:

  • cache needs to be configured according to latest file versions, not release-version (otherwise you'll have to constantly clear the cache and the QA will annoy you with already resolved bugs)

Does that make sense?
Any other pros / cons / recommendations?

Or is it a better approach to enable caching on the development environment just shortly to test some specific behavior (in my case the caching of the templates, or in another case the caching of the static files)

roberkules
  • 6,557
  • 2
  • 44
  • 52
  • 2
    Could you maybe spend two or three introductory sentences on the topic you're talking about specifically? You're giving virtually no context for your question. – deceze Jan 18 '12 at 03:22
  • 1
    I actually set the cache to 1 minute when it's in development. That makes it so it's still there, but won't cause an issue with new versions of the code and browsers. – Rangoric Jan 18 '12 at 03:23

1 Answers1

1

I think I disagree.

You don't want your client side code cached in dev. Else you are going to spend a lot of time clearing caches, and you are going to spend a lot of time figuring out why things don't work, only for it to be a "oops, I didn't clear my cache" issue.

You do want it cached for your releases. This is easily accomplished via configuration in your build process -- you can append some build specific info to the file names of your build artifacts, and the browser will cache the content for your. When a new release comes, the names of the relevant files are different so the browser will search for them.

hvgotcodes
  • 118,147
  • 33
  • 203
  • 236
  • I usually refresh the pages I work on via mouse gesture, avoiding the cache. and it's even a setting in Chrome's developer tools (to disable the cache). but that voids my `pro` that I'm already testing it like on production. Anyways, I'm interested what others (like you) think about it. – roberkules Jan 18 '12 at 03:36