forked from hacktoolkit/django-htk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cachekeys.py
34 lines (26 loc) · 1023 Bytes
/
cachekeys.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# HTK Imports
from htk.cache import CustomCacheScheme
from htk.constants import *
class StaticAssetVersionCache(CustomCacheScheme):
"""Cache management object for static asset version for CSS and JavaScript
Usually refreshed at the end of a deploy
So that client browser cache doesn't have stale JS/CSS after a deploy
"""
def get_cache_duration(self):
duration = TIMEOUT_30_DAYS
return duration
class TaskCooldown(CustomCacheScheme):
"""Cache management object for not performing background tasks too frequently
Default cooldown: no more than once per day
"""
def get_cache_duration(self):
duration = TIMEOUT_24_HOURS
return duration
class BatchRelationshipEmailCooldown(TaskCooldown):
"""Cache management object for not sending out BatchRelationshipEmails too frequently
Default cooldown: no more than once per day
prekey = user.id
"""
def get_cache_duration(self):
duration = TIMEOUT_24_HOURS
return duration