0

We have a service that exposes a calculation service through a REST interface (accessed by GET). To me this sounds like a perfect candidate for caching responses, and after reading an article by Andy King on using Apache's mod_expire for caching, this seemed the way to go. I basically thought setting

ExpiresByType application/json "access plus 1 hour"

to cache the responses. The calculation service uses indexes that are updated from time to time, so it needs to refresh from time to time, but other than that, I cannot see any pitfalls. What other ways would you recommend to do server-side caching that does not mean touching the code itself?

oligofren
  • 641
  • 2
  • 8
  • 23

1 Answers1

3

An Expires header gives you client-side caching (useful if the same client needs the same resource multiple times) but not server-side caching.

Since you're looking to cache server-side, mod_cache is what you need.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • As in setting CacheEnable+CacheDefaultExpire 3600 (one hour)? This would effectively trigger caching _on the server_ of a given URL for one hour, right? – oligofren Jul 04 '12 at 09:00
  • @oligofren It may not necessarily be that simple depending on your content (headers and other factors can interfere), but yeah, that's the idea. – Shane Madden Jul 04 '12 at 17:41