From c1c4b24b0a06124f0d13fe6bd6c385755494e24a Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Thu, 10 Nov 2022 12:39:37 -0500 Subject: [PATCH] add ability to change cache size --- relay/application.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/relay/application.py b/relay/application.py index 9acddbf..897a951 100644 --- a/relay/application.py +++ b/relay/application.py @@ -28,7 +28,7 @@ class Application(web.Application): self['database'] = RelayDatabase(self['config']) self['database'].load() - self['cache'] = DotDict({key: LRUCache(maxsize=self['config'][key]) for key in self['config'].cachekeys}) + self['cache'] = DotDict({key: Cache(maxsize=self['config'][key]) for key in self['config'].cachekeys}) self['semaphore'] = asyncio.Semaphore(self['config'].push_limit) self.set_signal_handler() @@ -117,3 +117,8 @@ class Application(web.Application): self['starttime'] = None self['running'] = False + + +class Cache(LRUCache): + def set_maxsize(self, value): + self.__maxsize = int(value)