You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All things works fine when I used cache wrapper in the examples. But I met a big problem if I want to cache a inner function when design a lazy query tools. For example:
frommemoizationimportcachedclassLazyQuery:
def__init__:
self.pipeline=list()
self.cache=cached(max_size=10, ttl=10)
defquery1(**args):
@cacheddeffunc():
# do something()self.pipeline.append(func)
returnselfdefquery2(**args):
@cacheddeffunc():
# do something()self.pipeline.append(func)
returnself# other query function with inner funciton cache wrapperdefrun():
_input, _output_=None, Noneforstepinself.pipeline:
_output=step(_input)
_input=_outputreturn_outputif__name__=="__main__":
lazy_query=LazyQuery()
foriinrange(5):
lazy_query.query1().query2().run()
lazy_query.pipeline.clear()
In fact, each inner cache wrapper funciton in every query has its own cache structures, like id(cache) in caching/lru_cache.py get_caching_wrapper(). Therefore, If the cached wrapper can add an extra position paramerter cache after custom_key_maker would be better.
All things works fine when I used cache wrapper in the examples. But I met a big problem if I want to cache a inner function when design a lazy query tools. For example:
In fact, each inner cache wrapper funciton in every query has its own cache structures, like id(cache) in
caching/lru_cache.py get_caching_wrapper()
. Therefore, If the cached wrapper can add an extra position paramerter cache after custom_key_maker would be better.The text was updated successfully, but these errors were encountered: