From: antirez Date: Fri, 22 May 2009 16:44:44 +0000 (+0200) Subject: README tutorial now reflects the new proto X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/2abee6f2154e75a68488cd508bf2eddcfcc33ebc?ds=inline README tutorial now reflects the new proto --- diff --git a/doc/README.html b/doc/README.html index 090196de..4ad8c0ed 100644 --- a/doc/README.html +++ b/doc/README.html @@ -81,22 +81,21 @@ our key was added without problems. Actually SET can never fail but the "+OK" sent lets us know that the server received everything and the command was actually executed.

Let's try to get the key content now:

 GET foo
-3
+$3
 bar
 
Ok that's very similar to 'set', just the other way around. We sent "get foo", -the server replied with a first line that is just a number of bytes the value -stored at key contained, followed by the actual bytes. Again "\r\n" are appended -both to the bytes count and the actual data.

What about requesting a non existing key?

+the server replied with a first line that is just the $ character follwed by
+the number of bytes the value stored at key contained, followed by the actual
+bytes. Again "\r\n" are appended both to the bytes count and the actual data. In Redis slang this is called a bulk reply.

What about requesting a non existing key?

 GET blabla
-nil
-
When the key does not exist instead of the length just the "nil" string is sent. -Another way to check if a given key exists or not is indeed the EXISTS command:

+$-1
+
When the key does not exist instead of the length, just the "$-1" string is sent. Since a -1 length of a bulk reply has no meaning it is used in order to specifiy a 'nil' value and distinguish it from a zero length value. Another way to check if a given key exists or not is indeed the EXISTS command:

 EXISTS nokey
-0
+:0
 EXISTS foo
-1
-
As you can see the server replied '0' the first time since 'nokey' does not -exist, and '1' for 'foo', a key that actually exists.

Ok... now you know the basics, read the REDIS COMMAND REFERENCE section to +:1 +
As you can see the server replied ':0' the first time since 'nokey' does not +exist, and ':1' for 'foo', a key that actually exists. Replies starting with the colon character are integer reply.

Ok... now you know the basics, read the REDIS COMMAND REFERENCE section to learn all the commands supported by Redis and the PROTOCOL SPECIFICATION section for more details about the protocol used if you plan to implement one for a language missing a decent client implementation.

License

Redis is released under the BSD license. See the COPYING file for more information.

Credits

Redis is written and maintained by Salvatore Sanfilippo, Aka 'antirez'.

Enjoy,