-
Notifications
You must be signed in to change notification settings - Fork 534
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
Caching not working with RedisStore Cache #917
Comments
Thank you for the bug report, I'll look into this |
@x4d3 I'm not able to reproduce your example results using RedisStore.
Could you try again with the current version of redis-rails? Also, in production on my own app, I'm getting good results with the |
@lgebhardt I'd recommend closing this issue, I'm unable to reproduce this bug. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using Rails.cache as a
resource_cache
appears to make the caching fail when config.cache_store is redis_store.I think the reason is due to the way Redis Cache serialise key as string when they are arrays.
When the key(an array) is serialised in the
self.write
method ofCachedResourceFragment
https://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/cached_resource_fragment.rb#L122 it is serialised as a string.
When the value is retrieved in the
lookup
method the hashhits
returned by theread_multi
methods has keys that are not array, but strings. The methodhas_key?
is then failing returning false instead of true.https://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/cached_resource_fragment.rb#L81
Simple example, with
config.cache_store = :redis_store
I've tried to serialise manually the keys (master...x4d3:master) without success, the test are failing.
Thank you,
The text was updated successfully, but these errors were encountered: