liberation/redis-limpyd — pull request #43 by twidi (2012-08-20 17:16:51+00:00)
Title: Rework commands system

I did a lot of work on the traverse_commands system and indexing, to be able to have pseudo-transactions when many commands have to be executed when only one is asked, to be sure nothing will be done on the update fields and its indexes during the "transaction".

For this, i use the `Lock` system provided by redis-py, qhich use the `setnx` command of redis.

So each time a modifier is called on a field, if it's indexable, we set a lock on the field for all instances of the model.

With this, we can have consistency when managing indexes. As it can slow down speed, and if you know what you want, you can disable locking for a whole model (by setting its `lockable` attribute to `False`) or only for a field (by setting the `lockable` argument to `False` during instantiation)

I also rewrote the `available_*` commands list, in a `_commands` dict, mainly to split full modifiers and partial modifiers. Partial modifiers are modifiers for which we don't know the final value when calling the command. With full modifier, we can speed the indexation, without having to fetch data from redis.
But this is not used yet.

If this PR is merged after the two others (related-fields and reduce-redis-calls), a little merge work willb e necessary (even if it's done in the other way). I'll be able to add commits here for that as soon as needed.