Pylru Cache

import pylru
cache = pylru.lrucache(100)
cache
<pylru.lrucache at 0x112997fd0>
# add 
cache['name'] = 'One'
cache['name']
'One'
# add 
cache['city'] = 'Toronto'
'city' in cache # this doesn't affect the cache order
True
cache.keys()
<generator object lrucache.keys at 0x1129923b8>
for key in cache.keys():
    print(key)
city
name
for value in cache.values():
    print(value)
Toronto
One
for k, v in cache.items():
    print(k, v)
city Toronto
name One
cache.clear()
cache
<pylru.lrucache at 0x112997fd0>
'name' in cache
False