Matthew Rudy Jacobs
Matthew Rudy Jacobs
Thanks for your contribution. And apologies I never looked at this before. But... Do you really think that's expected behaviour? I guess it depends what you're trying to memoize. But...
This makes a lot of sense. :+1:
This is interesting. You don't want to retain a list of all memoised objects, or else they can't be garbage collected. But you could selectively add objects to a list...
@JoeMcB what's a minimal example of the problem? eg. the tests memoize the `Book` class, and `flush_cache` works fine? https://github.com/matthewrudy/memoist/blob/510cb571cdea0fcb72fa8ec7560bc876f933f442/test/memoist_test.rb#L308-L316
@paneq thanks for the work. Any idea why it fails on the old rubies? I like the idea of giving more information, but why change from a warning to an...
@benlieb that depends what you mean by thread-safe. It doesn't synchronize calls to the cache. But it depends what objects your memoizing, and how they're used across threads. At the...
Ok, so to simplify your example, cut memoist out of it. ``` ruby class User < ActiveRecord::Base def payment_profile @payment_profile ||= Stripe::Client.instance.customer_get self end end ``` So this is memoized...
@benlieb yeah.
An example of how you could mess this up. ``` ruby user = User.find 123 5.times do Thread.new do 5.times do user.payment_profile user.payment_profile(true) end end end ``` but that's only...
@ashu210890 any idea why this breaks all the tests? which bit isn't backwards compatible?