Question

as we now, when it comes to "http caching system", we have two kind of caches: public and private and their difference is all about proxies existing between user and the server. proxies cannot store private caches. in this link, he talks about rack:cache calling it a kind of proxy cache and he says:

This means it cannot cache private content but it can cache public content.

but in the examples(even his examples) and in the reality, we see that by using stale or fresh_when(which use rack::cache) the private caches are stored and then rendered by 304.

so we confronted to a paradox. how did this rack:cache proxy store the private caches?

Was it helpful?

Solution

When you use stale? or fresh_when?, rack::cache is using that information to tell the client whether its cache it fresh or not. rack::cache is not caching the content.

A cache, if marked as private, can only be stored by the final user. But whether that cache is fresh or not can be determined by a proxy, like rack:cache.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top