splitwise / cacheable Goto Github PK
View Code? Open in Web Editor NEWA quick way to make cacheable method calls in Ruby
License: MIT License
A quick way to make cacheable method calls in Ruby
License: MIT License
As far as I can tell from source code there is no memoization of fetched cache value for later cached method calls on the same object. Is it on purpose?
To be honest, this behavior seems to be pretty surprising:
class Foo
include Cacheable
cacheable :bar
def bar
"foo"
end
end
foo = Foo.new
foo.bar # cache read and deserialization
foo.bar # cache read and deserialization
foo.bar # cache read and deserialization
Context: recently I saw a Rails app in the wild that cached some ActiveRecord model methods that in turn returned another ActiveRecord objects. And some places got terribly slow due to dozens of repeated calls to retrieve and deserialize which is especially slow and compute-intensive for AR objects, see this blog post for details (and yes, I know that doing so is a bad idea per se). So I had to get rid of cacheable in favor of pure memoization or manual caching with following memoization.
Redis is pretty great. Why not try and support it out of the box?
Hello there,
I am trying to cache methods calling Github API, all of them are working properly, except one in some specific conditions: It's retrieving a super long list of repositories (8200). So, I was wondering, if the value to store it's way to big, it's not being cached? How can I check that? Is there a log or something?
Thanks.
For example it will fail if used inside Foo::Bar::BazController
. Detailed error report and stack trace to come.
Hello, I've started to develop a gem with the same intent and similar syntax this week. While doing some research I ended up finding this gem and I wanted to know if it is still being maintained
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.