Closed Arcnor closed 9 years ago
Good spot. It seems the Twitter gem is inserting the Tweet ID into the hash - I dont think they mean to as it's for their own internal calls.
In the meantime I will fix this end just to pass in a copy.
Thanks for letting me know I had not noticed that. I used @params
as part of the key so that if these change then the cached content is invalidated.
It seems that tweets are always fetched. From my debugging and limited Ruby experience, the problem is the following:
An
Oembed
instance gets created. It'skey
is<url>-
(note the empty right part). After the tweet is fetched, that key becomes<url>-{id: <id>}
. So when we check on the cache, we use one hash, but when we store, the hash changes.I'm not sure how
@params
gets modified (unless when calling@client.oembed tweet, @params
that modifies them, of course).At least for my use case, making the key just
<url>
works, but having the@params
as part of the key might have some implications I'm not fully aware of.