Skip to content

Commit

Permalink
feat: add cachesize for inference cache
Browse files Browse the repository at this point in the history
Signed-off-by: s0nicboOm <i.kushalbatra@gmail.com>
  • Loading branch information
s0nicboOm committed Aug 31, 2023
1 parent 3581a82 commit 0243142
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion numalogic/udfs/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

# TODO: move to config
LOCAL_CACHE_TTL = int(os.getenv("LOCAL_CACHE_TTL", "3600"))
LOCAL_CACHE_SIZE = int(os.getenv("LOCAL_CACHE_SIZE", "10000"))


class InferenceUDF(NumalogicUDF):
Expand All @@ -35,7 +36,7 @@ class InferenceUDF(NumalogicUDF):
def __init__(self, r_client: redis_client_t, pl_conf: Optional[PipelineConf] = None):
super().__init__(is_async=False)
self.model_registry = RedisRegistry(
client=r_client, cache_registry=LocalLRUCache(ttl=LOCAL_CACHE_TTL)
client=r_client, cache_registry=LocalLRUCache(ttl=LOCAL_CACHE_TTL, cachesize=LOCAL_CACHE_SIZE)

Check failure on line 39 in numalogic/udfs/inference.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E501)

numalogic/udfs/inference.py:39:101: E501 Line too long (106 > 100 characters)
)
self.pl_conf = pl_conf or PipelineConf()

Expand Down

0 comments on commit 0243142

Please sign in to comment.