cache_method
cache_method copied to clipboard
Cache based on arguments AND object state; store in memcached, redis, or in-process. Like alias_method, but it's cache_method! One step beyond memoization.
It looks like cache_method no longer works on methods with keyword arguments as of Ruby 3.0; it attempts to send them as an additional final hash positional argument as opposed...
Implement https://github.com/seamusabshere/cache_method/issues/2 The implementation was a test task from a scammer client on Upwork. Look for another "test puzzle", Alex. Yes, I know this project is dead, lol.
I was scratching my head for a while as to how to cache a class method. I figured out that you can do it by calling cache_method on a method...
It might be worth noting in the README that the tests rely on memcached. For example: ``` ## Testing You must install and start memcached before running the test suite...
I almost implemented this but found a quick way around it so wanted to get thoughts on the reasoning here. Let's say you have an instance method you want to...
It would be interesting to have an "if" option to cache_method. This way we could enable caching with a condition: ``` ruby def slow_method ... end cache_method :slow_method, if: ->...
Has this code been licensed under an open source license, such as the MIT or Apache 2.0 license?
it would be nice to cache different methods in different places: ``` cache_method :foo, storage: :redis1 cache_method :bar, storage: :memcached2 ``` which you would have set up like ``` CacheMethod.config.storage[:redis1]...
Teach cache_method to track kwargs separately from args, rather than treating them as a hash arg in the final position. Fixes #17