Two queue (2Q) cache implementation in Python
Original paper: https://www.vldb.org/conf/1994/P439.PDF
pip install cache2q
from cache2q import Cache2Q
cache = Cache2Q(512)
# set value by key
cache.set("hello", "world")
# get value by key
cache.get("hello") # "world"
# if key not exists
cache.get("key") # None
# remove key
cache.remove("hello")
cache.get("hello") # None
# clear cache
cache.clear()