90% of the time, ActiveRecord Cache access (CACHE MyModel Load (0.0ms)) is unnecessary for your app. Memoization or the appropriate preloading is easily 10x faster in every case.
-
Show this thread
-
Replying to @nateberkopec
I’m curious what experiences led you to that view? Was the access ratio never high enough that the cache hit was worth it?
1 reply 0 retweets 0 likes -
Replying to @kaspth
AR cache only prevents I/O wait time. AR has many more costs than that: allocation, time spent checking to see if we should check cache, etc etc
1 reply 1 retweet 0 likes -
Replying to @nateberkopec @kaspth
Isn’t the main benefit to prevent having to run a particularly slow query multiple times?
1 reply 0 retweets 0 likes -
My point is that *actually running the query* is only a part of the cost of `SomeModel.where(whatever: :foo)`.
1 reply 0 retweets 0 likes -
Replying to @nateberkopec @kaspth
Yep I agree with your point. And my add-on point is that the significance of the cache depends greatly on whether this is a 10ms query or a 100ms query we’re talking about
1 reply 0 retweets 1 like
Or just don't make the same query multiple times in a request.
-
-
Yep this too.
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.