-
Notifications
You must be signed in to change notification settings - Fork 8
Description
It would be really helpful if the CacheControl object implemented a custom valueOf in order to compare CacheControl objects.
Use-case: I'm making a bunch of HTTP requests to various 3rd party servers and combining them into a single response. These requests have various Cache-Control headers, but I'd like my API to respond with the most restrive (i.e. least cachable) of the lot.
For instance, if I have a set like this:
max-age: 600, public
max-age: 300, public
I'd need the second of the two. But if I have a set like this:
private
max-age: 600, public
max-age: 300, public
I would need the first one.
I realize it might be difficult to translate the Cache-Control into a number, but I think it's ok if some options produce the same number (i.e. private could be -1 and immutable could be 100000000 or something). Or perhaps different options have different weights?