Add no-store, no-cache in Cache-Control headers
Changes
- Removed the logic to never use cache if either of
no-cache/no-storewas present - Instead they work as follows
-
no-cache: doesn't use cache even if the value is present but stores the response in the cache -
no-store: can use cache if present but will not add/update to cache - If both are passed, it will neither store nor use the cache. Will remove the max-age and ETag as well.
- Test cases
Associated Issue: https://github.com/long2ice/fastapi-cache/issues/144
Can I do something to help merging the PR ? I need it in one of my project.
Can I do something to help merging the PR ? I need it in one of my project.
@zozoh94 the owner @long2ice seems to be inactive. Probably adding more 👍 (+1) to the PR by community will help.
Hey @long2ice do you have time to review and push thru this fix please?
Thanks! Please resolve conflicts.
@Bharat23 @zozoh94 can anyone rebase and resolve conflicts?
Thanks! Please resolve conflicts.
@long2ice resolved the conflict.
@long2ice can you please take a look again?
Thanks!
@Bharat23 @zozoh94 I think we need to make tests pass, thanks to @long2ice for enabling auto merge.
@Bharat23 @zozoh94 I think we need to make tests pass, thanks to @long2ice for enabling auto merge.
I'll take care of them.
Thanks @Bharat23
@Bharat23 @zozoh94 I think we need to make tests pass, thanks to @long2ice for enabling auto merge.
@sultaniman @long2ice Had to alter and remove some test cases as they were breaking due to the change introduced in this PR
@long2ice can you please check again once you have time?
@Bharat23 can you please ignore mypy warnings for line 26 and 30 in tests/test_decorator.py, I can't push changes into your repo, otherwise I would do it.
@Bharat23 can you please ignore mypy warnings for line 26 and 30 in
tests/test_decorator.py, I can't push changes into your repo, otherwise I would do it.
@sultaniman I didn't understand. I am not seeing any mypy issue on 26 and 30. Can you point me to how/where I can see that and what specific error should I ignore?
@Bharat23 I meant the linter failed in test/test_decorator.py I suggested to use per line ignore instead of a global ignore.
@Bharat23 I meant the linter failed in
test/test_decorator.pyI suggested to use per line ignore instead of a global ignore.
@sultaniman done
@sultaniman @long2ice, can we get this merged please? Thanks
I would also be happy to get this PR done, only @long2ice can merge it.
@Bharat23 looks like the datetime dependency has minor upgrade and it no longer has to_atom_string method
/home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py
/home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:16 - error: Type of "to_atom_string" is partially unknown
Type of "to_atom_string" is "Unknown | (() -> str)" (reportUnknownMemberType)
/home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:20 - error: Cannot access attribute "to_atom_string" for class "Date"
Attribute "to_atom_string" is unknown (reportAttributeAccessIssue)
/home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:20 - error: Cannot access attribute "to_atom_string" for class "Time"
Attribute "to_atom_string" is unknown (reportAttributeAccessIssue)
/home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:20 - error: Cannot access attribute "to_atom_string" for class "Duration"
Attribute "to_atom_string" is unknown (reportAttributeAccessIssue)
4 errors, 0 warnings, 0 informations
WARNING: there is a new pyright version available (v1.1.381 -> v1.1.383).
@Bharat23 looks like the datetime dependency has minor upgrade and it no longer has
to_atom_stringmethod/home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py /home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:16 - error: Type of "to_atom_string" is partially unknown Type of "to_atom_string" is "Unknown | (() -> str)" (reportUnknownMemberType) /home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:20 - error: Cannot access attribute "to_atom_string" for class "Date" Attribute "to_atom_string" is unknown (reportAttributeAccessIssue) /home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:20 - error: Cannot access attribute "to_atom_string" for class "Time" Attribute "to_atom_string" is unknown (reportAttributeAccessIssue) /home/runner/work/fastapi-cache/fastapi-cache/tests/test_decorator.py:37:20 - error: Cannot access attribute "to_atom_string" for class "Duration" Attribute "to_atom_string" is unknown (reportAttributeAccessIssue) 4 errors, 0 warnings, 0 informations WARNING: there is a new pyright version available (v1.1.381 -> v1.1.383).
@sultaniman the method exists, this is a mypy issue. There is a mismatch between how the local vs github workflow env is configured because they contradict each other. Ultimately I had to add 2 ignores to satisfy both. Hopefully this is the last commit before this can be merged.
@Bharat23 @sultaniman Just looking at this PR now ... as it's a change to existing behaviour I'm minded to roadmap this for 1.0.0 which I'll be working on as soon as 0.3.0 is out the door. But happy to be persueded otherwise
+1; this brings the package in line with the RFC.