-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need a way to disable the identity map #285
Comments
I agree, there should be a way to initialize Here's what I'd propose:
Note: Since we're sort of aping the Here's the Rubinius implementation of |
I liked your proposed changes, very clear and a logical separation. The changes to def self.fetch_or_store(attrs={})
self.fetch(attrs) do
self.store(attrs)
end
end If nothing was passed to fetch, it would raise? |
Something like that. I think def self.fetch_or_store(attrs={})
self.fetch(attrs) do
object = self.new(attrs)
self.store(object)
end
end |
That makes sense, I don't have it implemented that way, changing it now. |
I'm not in love with the name def self.create(attrs={})
object = self.new(attrs)
self.store(object)
end
def self.fetch_or_create(attrs={})
self.fetch(attrs) do
self.create(attrs)
end
end What do you think? |
I know what you mean about |
I suppose defining a separate |
I was thinking along the same lines that an adaptable interface could be swapped in to use with the I'm coming around to |
Let's roll. 🎢 One more thing: |
The identity map is resulting in a growing memory usage in TweetStream: tweetstream/tweetstream#87. As new streaming responses are received, each response is added to the identity map when
Twitter::Status
objects are created. In this case, the identity map is only going to continue to grow, resulting in the "leak".It seems most logical to have a means to either disable it entirely or have a way to create
Twitter::Base
/Twitter::Identifiable
objects without hooking into the identity map. The way the current code is structured doesn't easily allow for option 2 without some rejiggering. Prior to working on a solution, I wanted to put it forth here for discussion.The text was updated successfully, but these errors were encountered: