Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple caching #161

Merged
merged 2 commits into from
Sep 28, 2020
Merged

Simple caching #161

merged 2 commits into from
Sep 28, 2020

Conversation

CasperWA
Copy link
Owner

@CasperWA CasperWA commented Sep 24, 2020

Related to #138.
While it does not implement asynchronous requests, it does implement cached responses.

Good for server-side caching:

  • Make sure requests are similar to previous ones.
    All query parameters and values are either added in an OrderedDict or extracted from a complete URL, sorted and reencoded into a complete URL.

Client side caching:

  • Employ CacheControl with a file cache that persists responses for 24h.

Also supplied flake8 with some teeth in CI and updated the code accordingly.


Missing:

  • No caching on "Local server" in debug mode.

@CasperWA CasperWA force-pushed the use_simple_caching branch 2 times, most recently from fb303c3 to 0ada503 Compare September 25, 2020 00:13
@CasperWA CasperWA marked this pull request as ready for review September 25, 2020 02:01
@CasperWA CasperWA force-pushed the use_simple_caching branch 4 times, most recently from 1c19a78 to 82d3062 Compare September 28, 2020 15:04
First, make sure request URLs are similar to previous request URLs.
All query parameters and values are either added in an OrderedDict or
extracted from a complete URL, sorted and reencoded into a complete URL.

Using FileCache:
Store cached requests responses in an object store-like cache using
cachecontrol[filecache], i.e., the lockfile package.
Expiration is set to 1 day.

Add buttons to clear cache and logs.
These are only visible if in debug mode (can be toggled on or off in the
log accordion).

Setup separate CacheControlAdapters.
In this way, caching can be avoided for requests to `http://localhost`
or `http://127.0.0.1`.
Add flake8 config through setup.cfg
@CasperWA CasperWA merged commit d0912f7 into develop Sep 28, 2020
@CasperWA CasperWA deleted the use_simple_caching branch September 28, 2020 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant