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

[FEAT] Implement a redis cache layer #543

Closed
6 tasks
sellnat77 opened this issue Apr 19, 2020 · 0 comments · Fixed by #574
Closed
6 tasks

[FEAT] Implement a redis cache layer #543

sellnat77 opened this issue Apr 19, 2020 · 0 comments · Fixed by #574
Assignees
Labels
Role: Backend Related to API or other server-side work v1 The first version of the site

Comments

@sellnat77
Copy link
Member

Overview

We have access to a free version of redis on heroku, may as well take advantage of it
See #450 for details

Action Items

  • Create redis docker-compose entry in both the actual compose file and the example compose file
  • Establish cache-key hierarchy (Probably hashed versions of the filter params)
    • ojf84u9r8h44gh9eg -> hashed version of something like (highland park, past 6mo, bulky items)
    • ojf84u9r8h44gh9eg:pins:all
    • ojf84u9r8h44gh9eg:pins:{srnumber}
    • ojf84u9r8h44gh9eg:ttc
    • ojf84u9r8h44gh9eg:freq
  • Enforce a global TTL for all keys
  • Ensure connections are short lived
  • Make redis optional
  • Use LFU for key recycling

Resources/Instructions

The caching algorithm will operate similar to this:
User selects filters
front end sends requests to backend
upon receiving request, hash the input parameters

Check redis for...
- ojf84u9r8h44gh9eg:pins:all
- ojf84u9r8h44gh9eg:ttc
- ojf84u9r8h44gh9eg:freq

If the key is found, retrieve values and return to front end

If nothing is found, continue down normal paths for responses and update the redis keys with the global TTL for

- ojf84u9r8h44gh9eg:pins:all
- ojf84u9r8h44gh9eg:ttc
- ojf84u9r8h44gh9eg:freq

then return values to front end

In summary they cache will operate as either a GET then RETURN or a GET, NOTFOUND, SET, RETURN

@sellnat77 sellnat77 added the Role: Backend Related to API or other server-side work label Apr 19, 2020
@jmensch1 jmensch1 mentioned this issue Apr 22, 2020
8 tasks
@jmensch1 jmensch1 self-assigned this Apr 28, 2020
@Rabia2219 Rabia2219 added the v1 The first version of the site label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Role: Backend Related to API or other server-side work v1 The first version of the site
Projects
Development

Successfully merging a pull request may close this issue.

3 participants