The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling and reframing distorted thinking when you've been thinking this way your whole life. The CDJ can help with that 🧠✨ -- v2 is in development!
Every time entries is loaded, calls to database are made. This happens every time the user navigates to the entries page. This can be reduced to one using caching.
The flow with caching:
A user logs in and makes a request for their entries from the CDJ API.
The CDJ API checks Redis if entries are cached: false.
The CDJ API caches the entries in Redis for X time (this should be carefully considered based on the server storage, and potentially reset every time the user posts an entry as the data will become outdated)
The user retrieves their entries.
The user clicks away to visit another page.
The user returns to their entries and makes another request to retrieve their entry data from the CDJ API.
The CDJ API checks Redis if entries are cached: true.
The CDJ API returns the cached entries.
The user retrieves their entries data.
6 through 9 can be repeated every time until the user makes an action (e.g. posts a new entry) or the cache expires clearing the cache.
Every time entries is loaded, calls to database are made. This happens every time the user navigates to the entries page. This can be reduced to one using caching.
The flow with caching:
6 through 9 can be repeated every time until the user makes an action (e.g. posts a new entry) or the cache expires clearing the cache.