Skip to content
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

Key-string invalid when containing spaces or curley brackets #1

Open
MartinDevillers opened this issue Apr 24, 2010 · 3 comments
Open

Comments

@MartinDevillers
Copy link

(Just my 2cts when I used this awesome API)

Keys that contain spaces or curly brackets can lead to undesirable behavior.

By design, redis does not allow keys to contain spaces, as spaces are used to separate parameters. Thus, if the Key-string contains a space, the semantics of the subsequent call made to Redis by this API are changed. This can lead to some nasty behavior.

Curly brackets can lead to problems since at some point the string is passed through a String.Format in redis-sharp. The function mistakenly sees the curly brackets as a formatting placeholder, leading to exceptions or other undesirable behavior

@migueldeicaza
Copy link
Owner

So you think taht the code should validate that keys do not contain spaces or curly braces?

everyone would pay the price for that.

@MartinDevillers
Copy link
Author

If you want to squeeze out that last bit of performance then such checks are indeed 'unnecessary' overhead.

A quick benchmark tells me that checking a list of 1 million elements for spaces and curly braces takes about 150ms, while it still takes 11 seconds to actually store the information in Redis. Encoding the whole list to base64 form takes 800ms (which is what I ended up doing for my thesis project)

Even if these checks shouldn't be in the main redis API, one can still imagine a 'safe' redis API that does the checks..

@migueldeicaza
Copy link
Owner

Thanks for measuring it.

If you send me a patch I'll integrate the changes. I do not really have a lot of spare time right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants