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

Database Caching Implementation #959

Open
3 of 6 tasks
archx3 opened this issue Apr 19, 2024 · 0 comments
Open
3 of 6 tasks

Database Caching Implementation #959

archx3 opened this issue Apr 19, 2024 · 0 comments
Assignees

Comments

@archx3
Copy link
Contributor

archx3 commented Apr 19, 2024

DESCRIPTION

Implement caching in the backend of the MassEnergize app to improve loading speeds for users.

USER STORY

As a
backend engineer working on the MassEnergize app,
I want to
implement caching in the backend,
so that
I can improve the app's performance and provide users with a faster and more responsive experience.

As a
site user,
I want
the MassEnergize app to load quickly and efficiently,
so that
I can access information and features without delays or interruptions.

Possible Scenarios

SCENARIO 1.
GIVEN a user is browsing the MassEnergize app
WHEN the user requests data that is cacheable
THEN the data is retrieved from the cache, improving loading speed

SCENARIO 2.
GIVEN a user is browsing the MassEnergize app
WHEN the user requests data that is not in the cache even though cacheable
THEN the data is retrieved from the database and stored in the cache for future requests, improving loading speed for subsequent users

SCENARIO 3.
GIVEN a user is browsing the MassEnergize app
WHEN the user manually requests a refresh of the cached data
THEN the data is re-fetched from the database and updated in the cache, ensuring the user gets the most up-to-date information

Required Permissions

Any user with confirmed access to the profile page being viewed.

Acceptance Criteria

  • Implement caching using the Database Caching method in the Django backend
  • Create a custom annotation for easier caching implementation in service layer functions
  • Ensure the ability to manually fetch a fresh copy of the data from the database when force_refresh=True is passed
  • Update relevant service layer functions to use caching
  • Update relevant API endpoints to use cached data where appropriate
  • Ensure documentation is updated to reflect the new caching mechanism
Technical Considerations
  • Use the django-db-cache package for database caching
  • Add configuration for the cache in the Django settings file (settings.py)
  • Create a custom annotation to apply caching to service layer functions
  • Modify service layer functions to check for cached data and fetch fresh data if needed
  • Update API endpoints to use cached data where appropriate
  • Add documentation on how to use the caching mechanism in the project's documentation

Additional Notes

  • Consider performance testing before and after implementing caching to measure the impact on loading speeds
  • Monitor cache usage to ensure it is improving performance as expected
@archx3 archx3 converted this from a draft issue Apr 19, 2024
@archx3 archx3 self-assigned this Apr 29, 2024
@archx3 archx3 moved this from In Progress (Development) to Local Testing (Verification) in MassEnergize Software Apr 29, 2024
@abdullai-t abdullai-t moved this to Product Backlog in MassEnergize Software Nov 27, 2024
@vschiniah vschiniah moved this from Product Backlog to Sprint To-do in MassEnergize Software Dec 2, 2024
@abdullai-t abdullai-t assigned abdullai-t and unassigned archx3 Dec 2, 2024
@abdullai-t abdullai-t moved this from Sprint To-do to Product Backlog in MassEnergize Software Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Product Backlog
Development

No branches or pull requests

2 participants