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:
@@ -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 (باطلکردنِ کشِ پلنها)
|
||||
|
||||
Reference in New Issue
Block a user