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

Issue-361 : Implement Caching with Redis #1163

Merged
merged 13 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backend/REDIS_IMPLEMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Redis Implementation

This file is meant to document the potential one day addition of [Redis](https://redis.io/) to the activist backend. At time of creation, the team decided that adding in Redis is an extra service that we don't have capacity to maintain. The plan is to add it at some point, but only after simpler performance improvements have been implemented and exhausted.

An initial change that's needed is that [django-redis](https://github.com/jazzband/django-redis) should be added to the backend dependencies by adding it to [backend/requirements.in](./requirements.in) and [backend/requirements-dev.in](./requirements-dev.in). The commands within those files are then ran to add it to the respective `.txt` files.

## File Changes

Please see [#1163](https://github.com/activist-org/activist/pull/1163) where adding [Redis](https://redis.io/) to the backend was first done. The changes in that PR would be the basis of an eventual addition of [Redis](https://redis.io/).
7 changes: 7 additions & 0 deletions backend/content/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_str_methods() -> None:
assert str(task) == task.name
assert str(topics) == topics.name


def test_discussion_str_method():
"""Test the __str__ method of the Discussion model."""
user = UserFactory()
Expand All @@ -42,6 +43,7 @@ def test_discussion_str_method():
)
assert str(discussion) == f"{discussion.id}"


def test_faq_str_method():
"""Test the __str__ method of the Faq model."""
faq = Faq(
Expand All @@ -55,6 +57,7 @@ def test_faq_str_method():
)
assert str(faq) == faq.question


def test_image_str_method():
"""Test the __str__ method of the Image model."""
image_id = uuid4()
Expand All @@ -64,6 +67,7 @@ def test_image_str_method():
)
assert str(image) == f"{image_id}"


def test_location_str_method():
"""Test the __str__ method of the Location model."""
location_id = uuid4()
Expand All @@ -75,6 +79,7 @@ def test_location_str_method():
)
assert str(location) == f"{location_id}"


def test_social_link_str_method():
"""Test the __str__ method of the SocialLink model."""
social_link = SocialLink(
Expand All @@ -87,6 +92,7 @@ def test_social_link_str_method():
)
assert str(social_link) == social_link.label


def test_tag_str_method():
"""Test the __str__ method of the Tag model."""
tag_id = uuid4()
Expand All @@ -98,6 +104,7 @@ def test_tag_str_method():
)
assert str(tag) == f"{tag_id}"


def test_discussion_entry_str_method():
"""Test the __str__ method of the DiscussionEntry model."""
user = UserFactory()
Expand Down
1 change: 1 addition & 0 deletions backend/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@

ROOT_URLCONF = "core.urls"


# MARK: Templates

TEMPLATES = [
Expand Down
2 changes: 1 addition & 1 deletion backend/events/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# mypy: ignore-errors
import pytest

from events.factories import (
EventFactory,
EventAttendeeFactory,
Expand All @@ -31,6 +30,7 @@ def test_str_methods() -> None:
assert str(_format) == _format.name
assert str(role) == role.name


def test_event_text_str_method() -> None:
event = EventFactory.create()
event_text = EventText.objects.create(
Expand Down
1 change: 0 additions & 1 deletion backend/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ virtualenv==20.28.1
# via pre-commit
wheel==0.45.1
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
Loading