@@ -24,10 +24,10 @@ def wrapper(*args, **kwargs):
24
24
function_cache_key = utils .get_function_cache_key (func_name , args , kwargs )
25
25
cache_key = utils .get_hashed_cache_key (function_cache_key )
26
26
27
+ # We need to determine whether the object exists in the cache, and since we may have stored a literal value
28
+ # None, use a sentinel object as the default
27
29
sentinel = object ()
28
30
try :
29
- # Attempts to get cache key and defaults to a string constant which will be returned if the cache
30
- # key does not exist due to expiry or never being set.
31
31
value = cache .get (cache_key , sentinel )
32
32
except Exception :
33
33
logger .warning (
@@ -79,10 +79,10 @@ def wrapper(*args, **kwargs):
79
79
function_cache_key = utils .get_function_cache_key (func_name , args [1 :], kwargs )
80
80
cache_key = utils .get_hashed_cache_key (function_cache_key )
81
81
82
+ # We need to determine whether the object exists in the cache, and since we may have stored a literal value
83
+ # None, use a sentinel object as the default
82
84
sentinel = object ()
83
85
try :
84
- # Attempts to get cache key and defaults to a string constant which will be returned if the cache
85
- # key does not exist due to expiry or never being set.
86
86
value = cache .get (cache_key , sentinel )
87
87
except Exception :
88
88
logger .warning (
@@ -155,10 +155,10 @@ def __get__(self, obj, objtype):
155
155
def __call__ (self , * args , ** kwargs ):
156
156
cache_key , function_cache_key = self .create_cache_key (* args , ** kwargs )
157
157
158
+ # We need to determine whether the object exists in the cache, and since we may have stored a literal value
159
+ # None, use a sentinel object as the default
158
160
sentinel = object ()
159
161
try :
160
- # Attempts to get cache key and defaults to a string constant which will be returned if the cache
161
- # key does not exist due to expiry or never being set.
162
162
value = cache .get (cache_key , sentinel )
163
163
except Exception :
164
164
logger .warning (
0 commit comments