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

enhancement: Cache DB calls for card rendering #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renceInbox
Copy link
Collaborator

@renceInbox renceInbox commented Jun 5, 2023

Enable caching on Django and cache card template results from the DB.

Signed-off-by: Rommel Terrence Juanillo <terrence@newlogic.com>
@renceInbox renceInbox self-assigned this Jun 5, 2023
@renceInbox renceInbox changed the title enhancement: Cache DB calls for card template enhancement: Cache DB calls for card rendering Jun 5, 2023
Copy link
Contributor

@jeremi jeremi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to bust the cache when updating the card,
Write some tests

@@ -34,6 +35,14 @@ class CardViewSet(ModelViewSet):
authentication_classes = (TokenAuthentication,)
http_method_names = ("get", "post", "put", "delete")

def get_object(self):
card_data = cache.get("card_data")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it work? Do you cache all the card objects under the name card_data? Isn't it will always return the same card?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants