I'm writing a library that requests files via HTTP and HTTPS. To reduce traffic to often requested URLs, I want to cache the retrieved files and respect their cache settings.
Now the cache expiry seems to be a hard thing, because the HTTP RFC define so many of them that need to be checked in all possible combinations:
Expires
Cache-Control
(with dozens of possible values)Pragma
I can imagine that someone already wrote PHP code that implements all that stuff correctly. Where is it?
You're right: somebody's already done that :)
PHP framework Symfony2 comes with a caching reverse proxy as part of its standard distribution. Docs here: http://symfony.com/doc/2.0/book/http_cache.html