Cache miss each time if used on class instance method
See original GitHub issueLooks like self
param is being taken into account.
Current workaround that works is using empty args_rewrite
list:
class MyClass(object):
@cache_memoize(30, args_rewrite=lambda x: [])
def get_data(self):
#....
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Python functools lru_cache with instance methods
With a single cache per method, you can set the maxsize so that the total memory use is bounded regardless of the number...
Read more >Don't wrap instance methods with 'functools.lru_cache ...
Recently, fell into this trap as I wanted to speed up a slow instance method by caching it. When you decorate an instance...
Read more >Method caches broken between `it` · Issue #2194 - GitHub
Hi, I noticed that RSpec seems to be breaking method caches between it ... It appears that every time you use instance_exec on...
Read more >3 Common Mistakes when Implementing Spring Cache ...
1. Invocation of cacheable methods from the same class ... In Spring boot, the default advice mode for processing caching annotation is “proxy”....
Read more >C++ Instance Methods Cache Friendly? - C++ Forum
If we assume the simpler case, the cache behavior will be optimal. A cache that misses simply because it has to fetch memory...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s not issue but expected behavior. I see at least two correct ways to handle this situation:
or
+1 on
method_decorator