TTL Cache Check
from cachetools import TTLCache
import time
cache = TTLCache(maxsize=10, ttl=10)
cache['city'] = 'Toronto'
print(cache['city'])
Toronto
time.sleep(5)
if('city' in cache):
print(cache['city'])
else:
print('Cache not found')
Toronto
time.sleep(5)
print('city' in cache)
False