Skip to content

Instantly share code, notes, and snippets.

@andialbrecht
Created May 19, 2012 19:53
Show Gist options
  • Save andialbrecht/2732200 to your computer and use it in GitHub Desktop.
Save andialbrecht/2732200 to your computer and use it in GitHub Desktop.
try:
from collections import OrderedDict
except ImportError:
OrderedDict = None
from UserDict import UserDict
if OrderedDict is not None:
class Cache(OrderedDict):
def flush(self):
# remove oldest entries
else:
class Cache(UserDict):
def flush(self):
self.data = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment