From 4ae4ac1d126da7dc7125b3919ddd40e270d93491 Mon Sep 17 00:00:00 2001 From: prculley Date: Wed, 29 Nov 2017 11:59:34 -0600 Subject: [PATCH] Fix duplicated method in ProxyCache Fixes #10291 Also changed size request to better utilize actual memory --- gramps/gen/proxy/cache.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/gramps/gen/proxy/cache.py b/gramps/gen/proxy/cache.py index ed7845e29..3b207ddcb 100644 --- a/gramps/gen/proxy/cache.py +++ b/gramps/gen/proxy/cache.py @@ -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