mirror of https://gitlab.com/bashrc2/epicyon
Comments
parent
090c67201c
commit
e485010e4e
2
cache.py
2
cache.py
|
@ -31,9 +31,11 @@ def getPersonFromCache(personUrl: str):
|
|||
"""Get an actor from the cache
|
||||
"""
|
||||
if personCache.get(personUrl):
|
||||
# how old is the cached data?
|
||||
currTime=datetime.datetime.utcnow()
|
||||
cacheTime=datetime.strptime(personCache[personUrl]['timestamp'].replace('T',' '))
|
||||
daysSinceCached=(currTime - cacheTime).days
|
||||
# return cached value if it has not expired
|
||||
if daysSinceCached <= 2:
|
||||
return personCache[personUrl]['actor']
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue