lablup / lablup/backend.ai

Cache user information fetched in the auth middleware

Open
#694 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

Currently the manager always fetches the user/keypair information from the database in the `auth_middleware`.Let's cache those information using pickle in Redis to reduce the transaction loads.(Since this is just a cache, we can simply fallback to the database query when there are unpickling errors after version updates, database schema changes, etc.)We also need to invalidate the cached entries when the user and keypair data is updated/deleted/purged/deactivated.

Q. Could we utilize the signal subsystem in SQLAlchemy to detect whenever rows in the users/keypairs tables are modified or deleted, without manually adding invalidation triggers all around the codebase?

JIRA Issue: BA-252

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.