...
Respective keys are also mentioned for a read with a particular id.
API ENDPOINT | KEY |
---|---|
/v1/user/read/:uid | userId |
/v2/user/read/:uid | userId |
/v1/user/getuser | userId |
/v1/role/read | |
/v1/user/course/list/:uid | userId |
/v1/org/read | orgId |
/v1/page/read/: pageId | pageId |
/v1/page/section/list | pageId |
/v1/page/section/read/:sectionId | sectionId |
/v1/course/batch/read/:batchId | batchId |
/v2/dashboard/progress/course:batchId | batchId |
/v1/system/settings/get/:field | |
/v1/note/read/:noteId | noteId |
/v1/issuer/list |
|
/v1/user/skill/read-userId | userId |
How Redis will be used :
Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability. It will be used to keep API response of the most frequently used and least frequently updated API.
Redis supports primary key, indexing and composite key implementation which will be very beneficial in our use case.
...
For example : Key combination for user read API . userId and singled valued hash for each group (u for User , o for Org )
Following will the scenario:
- Service will get data from Redis and returns the response to controller.
- Service will not get data from Redis, now Service will get data from Database , returns it and update Redis cache for the future : considering valid data scenario.
- Service will not get data from Redis, Now it will try to get it from Database . But For a invalid data it returns the error response. No Redis cache update. : considering invalid data scenario.