cache the subscription plans list

subscription/views.py
  - PlansListView: served from cache (subscription:plans:v1, 1h TTL);
    plans change ~never and the list is read on every subscription screen.
subscription/receivers.py (new)
  - post_save/post_delete on Plan -> cache.delete(PLANS_CACHE_KEY).
subscription/apps.py
  - SubscriptionConfig.ready() imports receivers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-30 08:46:30 +03:30
parent d25ecab0b3
commit 40b4dd53a9
3 changed files with 41 additions and 15 deletions

View File

@@ -4,3 +4,6 @@ from django.apps import AppConfig
class SubscriptionConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'subscription'
def ready(self):
from . import receivers # noqa: F401 (باطل‌کردنِ کشِ پلن‌ها)