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

Caching typeorm queries in Used for Auth #1927

Open
4 tasks
dheepak-aot opened this issue May 5, 2023 · 0 comments
Open
4 tasks

Caching typeorm queries in Used for Auth #1927

dheepak-aot opened this issue May 5, 2023 · 0 comments

Comments

@dheepak-aot
Copy link
Collaborator

dheepak-aot commented May 5, 2023

Describe the task
Implement cache for queries used in following methods.
image.png

image.png

The default lifetime of the ORM Cache across the application is 10 minutes.

When eviction/removal of cache must be instantaneous and cache cannot live for 10 minutes. One of such scenario is when an institution user is disabled by the admin and the disabled user should NOT be able to access any information right after them being disabled. What it means is, the cache holding the query result pertaining to isActive status of user must be removes immediately when isActive is updated by some other operation.

In such scenario, we could use the the cache id to remove the cache like this.
The cache id must be a combination of cache_id_name + all the parameters of the query.

image.png

Ref to typeorm Cache: https://github.com/typeorm/typeorm/blob/master/docs/caching.md

Create a centralized provide to manage the cache keys and cache removal across the application.

export class ORMCacheManager {
  getUserLoginCacheName(userName:string):string {

  }
  clearUserLoginCache(userName:string) {

  }
}

Acceptance Criteria

  • Enable cache for the queries mentioned above
  • Create centralized method for cache key and cache removal
  • Wherever the cache is required to be removed immediately on an update/insert, implement cache removal as mentioned.
  • Enable the cache for the query that had the cache removed in ticket Remove cache from Institution type on SIMS API #2043
@dheepak-aot dheepak-aot changed the title Caching typeorm queries in SIMS Caching typeorm queries in Used for Auth May 5, 2023
@michesmith michesmith added this to the 3.0 Full-Time Students MVP milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants