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
Hi, great module first of all!
Right now I have to use cachetools module, which provides cachedmethod decorator for using with class/instance methods.
Would it be possible to implement same for cached decorator so it would be possible to run something like:
classExample(object):
def__init__(self):
self._cache=LRU()
@cached(operator.attrgetter('_cache'))defheavy_func(self):
print('Called')
return100500instance=Example()
for_inrange(20):
instance.heavy_func() # should print `Called` just once
Ideally I would prefer single decorator for generic functions and for class methods, but if it's not possible it could be implemented with two different ones.
The text was updated successfully, but these errors were encountered:
@mahmoud, looks just awesome! Much cleaner interface and easy to use. Thank you very much!
Could you please tell when do you plane to release it on PyPI?
Hi, great module first of all!
Right now I have to use cachetools module, which provides
cachedmethod
decorator for using with class/instance methods.Would it be possible to implement same for
cached
decorator so it would be possible to run something like:Ideally I would prefer single decorator for generic functions and for class methods, but if it's not possible it could be implemented with two different ones.
The text was updated successfully, but these errors were encountered: