sorentwo / readthis

:newspaper: Pooled active support compliant caching with redis
MIT License
504 stars 40 forks source link

Handle read_multi and fetch_multi with no keys #3

Closed rykov closed 9 years ago

rykov commented 9 years ago

In instances when read_multi or fetch_mutli are called no keys, Redis throws this error:

ERR wrong number of arguments for 'mget' command

This PR is to handle this case gracefully following the behavior of ActiveSupport::Cache::FileStore. Both added tests include a namespace option to make sure the empty check happens after extract_options!

rykov commented 9 years ago

Looks like CI fails because sorentwo/redis-activesupport repo no longer exists. Would you like me to patch the Gemfile to redis-store/redis-activesupport?

sorentwo commented 9 years ago

@rykov: Oops, I just pointed to the proper redis-activesupport in 4e24ae0. Also, that's the first time hound has run on this repo (pay no mind to the quoting comments).

sorentwo commented 9 years ago

This is great to have. Thanks for the PR!

rykov commented 9 years ago

@sorentwo I rebased against the latest master. Also, I don't agree with @houndci about single-quoted strings. I haven't done any tests, but I imagine non-interpolated strings in single quotes are marginally faster than double-quoted ones.

sorentwo commented 9 years ago

@rykov: Don't worry about houndci, I haven't configured it at all. There was an interesting showdown about single and double quotes recently which showed that there is no performance difference at all. Regardless, in the Ruby world I'm used to single quotes all the time--will keep that alive here.