Skip to content

Commit 5d64de5

Browse files
author
Richard Jones
committed
fix to LRU cache
1 parent bc86bb1 commit 5d64de5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

roundup/backends/rdbms_common.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.11 2002-09-23 06:48:35 richard Exp $
1+
# $Id: rdbms_common.py,v 1.12 2002-09-23 07:15:32 richard Exp $
22

33
# standard python modules
44
import sys, os, time, re, errno, weakref, copy
@@ -577,7 +577,7 @@ def getnode(self, classname, nodeid):
577577
if self.cache.has_key(key):
578578
# push us back to the top of the LRU
579579
self.cache_lru.remove(key)
580-
self.cache_lry.insert(0, key)
580+
self.cache_lru.insert(0, key)
581581
# return the cached information
582582
return self.cache[key]
583583

@@ -616,7 +616,8 @@ def getnode(self, classname, nodeid):
616616
self.cache[key] = node
617617
# update the LRU
618618
self.cache_lru.insert(0, key)
619-
del self.cache[self.cache_lru.pop()]
619+
if len(self.cache_lru) > ROW_CACHE_SIZE:
620+
del self.cache[self.cache_lru.pop()]
620621

621622
return node
622623

0 commit comments

Comments
 (0)