From a77a21f90c266ce496fef7591a371d859d91f069 Mon Sep 17 00:00:00 2001 From: markusmo Date: Sat, 19 Sep 2020 12:42:10 +0200 Subject: [PATCH] changed caching behavior --- shop/models/product.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shop/models/product.py b/shop/models/product.py index c154027e9..aef3eea8e 100644 --- a/shop/models/product.py +++ b/shop/models/product.py @@ -4,7 +4,8 @@ from django.apps import apps from django.conf import settings -from django.core import cache, checks +from django.core import checks +from django.core.cache import cache from django.db import models from django.db.models.aggregates import Sum from django.db.models.functions import Coalesce @@ -370,7 +371,7 @@ def invalidate_cache(self): """ shop_app = apps.get_app_config('shop') if shop_app.cache_supporting_wildcard: - cache.delete_pattern('product:{}|*'.format(self.id)) + cache.delete('product:{}|*'.format(self.id)) ProductModel = deferred.MaterializedModel(BaseProduct)