1
0
Fork 0

fix(api): include cache keys in logs

This commit is contained in:
Sean Sube 2023-03-05 21:50:01 -06:00
parent 35dc8a0bc4
commit 55576ae87c
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 4 additions and 4 deletions

View File

@ -21,10 +21,10 @@ class ModelCache:
def get(self, tag: str, key: Any) -> Any:
for t, k, v in self.cache:
if tag == t and key == k:
logger.debug("found cached model: %s", tag)
logger.debug("found cached model: %s %s", tag, key)
return v
logger.debug("model not found in cache: %s", tag)
logger.debug("model not found in cache: %s %s", tag, key)
return None
def set(self, tag: str, key: Any, value: Any) -> None:
@ -35,11 +35,11 @@ class ModelCache:
for i in range(len(self.cache)):
t, k, v = self.cache[i]
if tag == t and key != k:
logger.debug("updating model cache: %s", tag)
logger.debug("updating model cache: %s %s", tag, key)
self.cache[i] = (tag, key, value)
return
logger.debug("adding new model to cache: %s", tag)
logger.debug("adding new model to cache: %s %s", tag, key)
self.cache.append((tag, key, value))
self.prune()