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

Refresh User cache when user is modified #435

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Conversation

kubernetes-bad
Copy link
Contributor

Redis cache is now refreshed when User is modified.

Problem:

After creating or deleting a shared key, it is not immediately reflected on /get_user endpoint as it serves now stale cached version.

This adds functionality to bust the user cache - both by id and by api_key - ensuring the cached results are always fresh.

How to test:

  1. call GET /api/v2/find_user, you should see [] under sharedkey_ids
  2. call GET /api/v2/users/:user_id, you should see [] under sharedkey_ids
  3. call PUT /api/v2/sharedkeys with body {}
  4. call GET /api/v2/find_user again, you should see ['5d81849a...'] under sharedkey_ids
  5. call GET /api/v2/users/:user_id again, you should also see ['5d81849a...'] under sharedkey_ids
  6. call DELETE /api/v2/sharedkeys/:keyId
  7. call GET /api/v2/find_user, you should see [] under sharedkey_ids
  8. call GET /api/v2/users/:user_id, you should see [] under sharedkey_ids

@db0 db0 merged commit b8b9c9e into Haidra-Org:main Jul 29, 2024
2 of 3 checks passed
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.

2 participants