# cache key 修正
This commit is contained in:
parent
1c36bd85f9
commit
5b62ef5a1e
|
@ -90,7 +90,7 @@ class DeviceLogStatisticAPIView(APIView, RoleMixin):
|
||||||
tz = pytz.timezone("UTC")
|
tz = pytz.timezone("UTC")
|
||||||
today = datetime.now(tz).date()
|
today = datetime.now(tz).date()
|
||||||
|
|
||||||
# calc monthly count, put it in redis as cache.
|
# calc month_ago_count, put it in redis as cache.
|
||||||
if cache.get('month_ago_count'):
|
if cache.get('month_ago_count'):
|
||||||
month_ago_count = cache.get('month_ago_count')
|
month_ago_count = cache.get('month_ago_count')
|
||||||
else:
|
else:
|
||||||
|
@ -105,7 +105,7 @@ class DeviceLogStatisticAPIView(APIView, RoleMixin):
|
||||||
month_ago_count = total_count - one_month_ago_count
|
month_ago_count = total_count - one_month_ago_count
|
||||||
else:
|
else:
|
||||||
month_ago_count = 0
|
month_ago_count = 0
|
||||||
cache.set('monthly_count', month_ago_count, 60 * 60)
|
cache.set('month_ago_count', month_ago_count, 60 * 60)
|
||||||
|
|
||||||
# calc daily count, put it in redis as cache.
|
# calc daily count, put it in redis as cache.
|
||||||
if cache.get('daily_count'):
|
if cache.get('daily_count'):
|
||||||
|
|
Loading…
Reference in New Issue