Fix duplicated method in ProxyCache

Fixes #10291
Also changed size request to better utilize actual memory
This commit is contained in:
prculley 2017-11-29 11:59:34 -06:00 committed by Nick Hall
parent efabb77567
commit 4ae4ac1d12

View File

@ -57,7 +57,10 @@ class CacheProxyDb:
if handle:
del self.cache_handle[handle]
else:
self.cache_handle = LRU(100000)
# Memory allocation is power of 2 where slots has to fit.
# LRU uses one extra slot in its work, so set max to 2^17-1
# otherwise we are just wasting memory
self.cache_handle = LRU(131071)
def get_person_from_handle(self, handle):
"""
@ -104,15 +107,6 @@ class CacheProxyDb:
self.cache_handle[handle] = self.db.get_place_from_handle(handle)
return self.cache_handle[handle]
def get_place_from_handle(self, handle):
"""
Gets item from cache if it exists. Converts
handles to string, for uniformity.
"""
if handle not in self.cache_handle:
self.cache_handle[handle] = self.db.get_place_from_handle(handle)
return self.cache_handle[handle]
def get_citation_from_handle(self, handle):
"""
Gets item from cache if it exists. Converts