summaryrefslogtreecommitdiff
path: root/pylru.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylru.py')
-rw-r--r--pylru.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pylru.py b/pylru.py
index fd44f97..3a30ec1 100644
--- a/pylru.py
+++ b/pylru.py
@@ -75,7 +75,6 @@ class lrucache(object):
self.table.clear()
-
def __contains__(self, key):
return key in self.table
@@ -85,7 +84,6 @@ class lrucache(object):
node = self.table[key]
return node.value
-
def __getitem__(self, key):
# Look up the node
node = self.table[key]
@@ -158,6 +156,11 @@ class lrucache(object):
# need to adjust the 'head' variable.
self.head = node
+ def update(self, items):
+
+ # Add multiple items to the cache.
+ for n, v in items.items():
+ self[n] = v
def __delitem__(self, key):