Add support for private and public Cache-Control attributes
florimondmanca opened this issue · comments
Florimond Manca commented
While #4 will add support for adding arbitrary Cache-Control
attributes, the private
and public
attributes are a bit special. They are exclusive, in that only one of them should be present in the Cache-Control
header. Besides, if private
is present then the response should never be cached.
To implement this feature:
- Modify the
Cache-Control
header generation to allow passingprivate=True
andpublic=True
to the@cache_control
header (resulting in theprivate
orpublic
directives being present in theCache-Control
header).- Make sure that only one of
private
orpublic
is passed to@cache_control
, or raise an exception (e.g.ValueError
). - If one of
public
orprivate
is already present in theCache-Control
header (this may happen if e.g. the view returned as response withCache-Control: public
), it should be overridden.
- Make sure that only one of
- In
store_in_cache()
, make sure to not store the response in the cache if theprivate
cache-control directive is present. - Add tests for the new behavior (and modify the one that was testing that
private
andpublic
weren't supported yet).
Note that this can only be tackled once #4 has been resolved.
Florimond Manca commented
#4 is in, so we can start working on this issue. :)