GithubHelp home page GithubHelp logo

r.keys should retrurn an array about redis-rb HOT 10 CLOSED

redis avatar redis commented on June 27, 2024
r.keys should retrurn an array

from redis-rb.

Comments (10)

antirez avatar antirez commented on June 27, 2024

The server changed return type, I fixed that in 1.x branch and Ezra merged. I guess that with 2.0 this was re-inserted. My fault as I did not wrote regression tests in my patch.

from redis-rb.

skaes avatar skaes commented on June 27, 2024

I used redis-rb 2.0.0 against redis 1.2.6.

from redis-rb.

soveran avatar soveran commented on June 27, 2024

Fixed in 2.0.1.

from redis-rb.

skaes avatar skaes commented on June 27, 2024

unfortunately, it's not fixed:

require 'rubygems'
require 'redis'
r = Redis.new
r.set("a b c", "x")  # ==> "OK"
r.get("a b c")       # ==> "x"
r.keys("*")          # ==> ["a", "b", "c"]

I think this should be ["a b c"], right?

from redis-rb.

soveran avatar soveran commented on June 27, 2024

Even if a key with spaces works for all operations, I think it will never work with the keys 1.2.6 because it returns the keys as a space separated string. Sadly, there's no way to determine in that string the beginning and end of keys containing spaces.

The fix included in 2.0.1 assumes keys don't contain spaces, which is the best we can do at this point.

from redis-rb.

skaes avatar skaes commented on June 27, 2024

bummer. but thanks a lot for the quick reaction.

from redis-rb.

soveran avatar soveran commented on June 27, 2024

You're welcome.

from redis-rb.

antirez avatar antirez commented on June 27, 2024

Hey soveran, skaes: my patch checked if the returned value (from the low level decoding function) was an array or a string. If it's a string, just split it. This is the relevant commit:

http://github.com/ezmobius/redis-rb/commit/07579be932511f4fd5598dbbda1f0f154d836c76

I think we should fix this for 2.0.x as well.

Cheers,
Salvatore

from redis-rb.

soveran avatar soveran commented on June 27, 2024

antirez: yes, it's already fixed in 2.0.1. The other problem I think has no solution, though.

from redis-rb.

antirez avatar antirez commented on June 27, 2024

Sorry misunderstood the chat. The only fix is switching to Redis 2.0 indeed.

Cheers,
Salvatore

from redis-rb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.