|
README
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
► Sign in to add a comment
|
Search
|
|
README
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
The documentation for the SET command is somewhat confusing. it implies that "SET key value" sets "key" to "value", but the bulk operations docs look like "value" there is really the length of the value, and then you have the actual value.
Hello Dane, yes I'm improving the docs, the SVN version is already a bit better (but note that the protocol it describes is not the one of beta-3 but the one of beta-4, there is some minor change to some command behavior).
Btw the commands section describe the semantic of the command, not the protocol. Every command that takes as last argument data it takes it in form of a bulk write. Only the last argument can be a bulk write argument btw.
Please if you want more details subscribe to the redis google group, I'll be very glad to describe every non clear point of the doc by mail, and then of course fix the doc too :) Thanks for your interest.
The description of LLEN says it returns -1 if the value is not a list; but the return-value doc says it returns -2. I'm guessing the second one is a typo. It might actually be a good idea to define a set of numeric error codes across the entire API. Operations that return errors as strings could return the numeric code instead or in addition to the string; this helps clients detect which error they got, and to localize error messages for the end user.
Thanks Jens, actually they are defined but there is a syntax error in the wiki:
ok documentation fixed.
I miss a delete command on a list by value. For example a user would like to delete a twitter message in your twitter clone. If you think I can detail the problem.
Hello, yes I've this in the TODO list
LSEARCH mylist <element>
returns the index of the first element, or -1 if it was not found.
LREM mylist <element>
remove all the occurrences of element in the list, returns 0 if the element was not found, 1 if the element was found and removed.
I don't know if it can be a good idea to add a command to remove just the first or the last occurrence found. Any hint?
Btw I need as much details as possible on your specific problem in order to understand better how generic it is. Thank you very much!
Yes, that LREM seems to be the solution.
So, let's say I would like to setup a twitter clone. As I see, I can store all the messages in a list, but if the user would like to delete a message, that's not possible with an atomic commmand, but I need two (getting the item number, deleting the item). As the list can change meanwhile, that seems to be a bad solution. So LREM seems to be a good idea for that if I'm including a timestamp or so in the messages, so they're unique.
Hello barthazi, there is a much simpler solution to implement comment deletion. Just remove the post<id> key and leave the ID on the list, but handle missing comments in pagination.
Anyway I think LREM o LDEL (I don't know how'll name it!) is an important addition. Also note that Redis is going to implement locking with key granularity so it will be possible to create new atomic operations from scratch.
(off: Andras is my first name, but we put it after the family name in Hungary just like Japanese)
You're right, but handling missing comments when I would like to get 10 items from the 3rd page can be quite difficult, and would cause additional requests (if a user delete a lot of comments, for example). And deleting the id from the list is the same case as I have wrote about. Anyway I agree with storing just the id in the list, this seems to be a better design solution.
Andras, I want to tell you that your country is fantastic, I was there the last summer and I had a very good time with wonderful food! In Italy it was also in use to put the name after the surname, now it is rarely used AFAIK.
About LREM, yes if there are a lot of deletes it's hard to handle, and actually deletion is used rarely enough so it's not a huge problem that LREM is O(N) in most of the cases. I'll absolutely add it, currently I'm just not sure if it should remove the first element, all the elements, or the two forms are required...
I think that to remove only the first occurrence is a good idea, since probably in many applications you have only this first occurrence, and you can stop scanning the list as soon as this element was found.
Thanks for the nice words. :) I think deleting only the first occurrence may be okay for most of the cases, but adding an optional parameter, or an other command to remove all the occurrences may be not a bad idea. Also implementing LOCK is a good idea.
Hello again Andras! I'm adding both the possibilities. Basically it is something like this:
LREM key count
LREM will start to remove elements from the List at key until count elements are removed. If count is 0 LREM will simply remove ALL the elements matching.
The command returns the number of elements removed. We should cover a lot of cases with this, just it is not able to remove elements in the reverse order, starting from tail...
Andras, we have LREM in the SVN. It's more powerful than the one I described since it supports a negative 'count' parameter to delete elements starting from the tail.
Cheers, antirez.
Hello. I am considering using redis (instead of memcache) as a cache server in front of multiple instances of MySQL DB instances. Do u know of anybody who has used redis + MySQL? Are there any guidelines or configuration info?
Regards, DT
Hello DT,
I use it myself exactly in this configuration :) We replaced Memcached with Redis and got a boost in latency, I don't understand if we did something from with Memcached or the Ruby lib we were using was slow, but it's much faster now using Redis.
Guidelines: well, EXPIRE is under development so for now you don't have the ability to set timeouts. Just make sure to disable the disk saving if for you it's just a cache, or maybe just save from time to time, like every 30 minutes.
This is how we work with Redis as cache:
when we want an object, we ask for this object in Redis. If we get 'nil' as reply the object is not on the cache, so we compute it and SET it back into the Redis server, serialized with Json, or simply as an HTML string in parts where we can just cache the HTML and don't care (not always possible).
When instead an object is modified, we just DEL-ete it. So the object will be created on the cache only if it will be requested again. The lazy-way.
That's all... please for more information make sure to subscribe to the Redis google group. Thank you very much.
Antirez, Thanks a lot for valuable feedback. I will subscribe, per your suggestion. DT
It might be helpful to mention somewhere that lists are implemented as a normal doubly-linked list (as opposed to an array). Once I realized this, it made a lot more sense why operations have the runtimes that they do.
For example, now it makes sense why LPUSH and LPOP are O(1), but LINDEX is O(N). And it makes sense that LINDEX(+/- small number) can be done quickly in practice, since you can just traverse from the head/tail (whichever is closer).
Note that TC can and will corrupt its database and applications may not notice. I'm thinking my time porting it to Win32 was wasted. TC directly mmaps the main hash bucket array and the start of the data, and as soon as you write to that mapped data the OS can push that into the file - which leads to a window for corruption from that first memory update to the completion of both the mflush and the flush of any data written using the file update APIs. There is no flag to indicate that the database was left in a dirty state, either. (Well, I should look at the latest code, but a change to fix this would be a big change)
A comparison with GigaBASE and/or FastDB is probably in order.
Hello, every time Redis saves it performs a full dump on disk, on a temp file, atomically renamed when the save finished. So it's always safe to copy the data while the server is running.
Hi, looks like this is the project I've been looking for.
One question though, is a C (not C++) library available?
Hi,
I am playing with Redis and its Tcl interface, congrats for the great job.
Two questions:
A) I am reading some utf-8 file via Tcl and want to store it in redis, but I suspect I am doing something wrong as I don't get my utf-8 back. Is there any particular point I should know when dealing with utf-8 and redis?
B) From the Tcl interface, if I ask for a key that does not exists I get, or so it seems, and empty string. Shouldn't I be getting a 'nil' code or anything like it?
Thanks a lot. Redis is great.
jima
There is outdated info on the page: 'Values can be Strings, Lists or Sets. Keys can be a subset of strings not containing newlines ("\n") and spaces (" ").' With new multi-bulk command protocol (from v1.1 and up) this limitation is no longer there.
@birukoff: in theory this limitation is no longer here but for latency concerns client libs should continue to use the old protocol when possible, so actually it's safe to consider keys not binary safe at least for now.
Common Lisp interfrace can be found at: http://github.com/vseloved/cl-redis
... another Common Lisp interface: http://github.com/death/lredis
hi, got some problems with stackless python blocked when after exec "stackless.run()" what should i do?
thx all
Hi,
How do I disable persistence completely? I commented all the saves in the config, but after I kill the process, a dump.rdb always get created.
Thanks
Hi sir,
i am new to the Grails and Redis .
i have to build a project by using above technologies.
i feel comfort with Grails but i coming to Redis i know basic command now to run it thats it i dont know more than that.
can u help me out .
give me the basic stuff which need to practice and i am using STS tool.give me the sample project which build on both Grails and Redis .
and pls explain me how to configure Redis in config.groovy.
i am waiting for ur help and suggestions .
if possible please mail me to ” sivakotiuday@gmail.com” .
thank you.
Your Uday.