fix(nodes): do not disable invocation cache delete methods

When the runtime disabled flag is on, do not skip the delete methods. This could lead to a hit on a missing resource.

Do skip them when the cache size is 0, because the user cannot change this (must restart app to change it).
This commit is contained in:
psychedelicious 2023-09-22 16:48:58 +10:00 committed by Kent Keirsey
parent 60b3c6a201
commit 7d683b4db6

View File

@ -56,14 +56,14 @@ class MemoryInvocationCache(InvocationCacheBase):
pass
def delete(self, key: Union[int, str]) -> None:
if self.__max_cache_size == 0 or self.__disabled:
if self.__max_cache_size == 0:
return
if key in self.__cache:
del self.__cache[key]
def clear(self, *args, **kwargs) -> None:
if self.__max_cache_size == 0 or self.__disabled:
if self.__max_cache_size == 0:
return
self.__cache.clear()
@ -94,7 +94,7 @@ class MemoryInvocationCache(InvocationCacheBase):
)
def _delete_by_match(self, to_match: str) -> None:
if self.__max_cache_size == 0 or self.__disabled:
if self.__max_cache_size == 0:
return
keys_to_delete = set()