summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorandy <andy@whiskeymedia.com>2011-07-26 00:22:57 -0700
committerandy <andy@whiskeymedia.com>2011-07-26 00:22:57 -0700
commit7095c03cdbb9986b13e373e398b2509bea8c38bc (patch)
tree733a94514842c7ce37e25be4c49c5b7a67d1d834 /README.md
parente74ebdff99d654bbfa17116c8e8d784374211afc (diff)
downloadredis-py-7095c03cdbb9986b13e373e398b2509bea8c38bc.tar.gz
Renamed the base client class to StrictRedis, replacing ZADD and LREM in favor of their official argument order. The Redis class is now a subclass of StrictRedis, implementing the legacy redis-py implementations of ZADD and LREM. Docs have been updated to suggesting the use of StrictRedis.
Diffstat (limited to 'README.md')
-rw-r--r--README.md65
1 files changed, 35 insertions, 30 deletions
diff --git a/README.md b/README.md
index ceb5a20..5cab32d 100644
--- a/README.md
+++ b/README.md
@@ -18,12 +18,46 @@ From source:
## Getting Started
>>> import redis
- >>> r = redis.Redis(host='localhost', port=6379, db=0)
+ >>> r = redis.StrictRedis(host='localhost', port=6379, db=0)
>>> r.set('foo', 'bar')
True
>>> r.get('foo')
'bar'
+## API Reference
+
+The official Redis documentation does a great job of explaining each command in
+detail (http://redis.io/commands). redis-py exposes two client classes that
+implement these commands. The StrictRedis class attempts to adhere to the
+official official command syntax. There are a few exceptions:
+
+* SELECT: Not implemented. See the explanation in the Thread Safety section
+ below.
+* DEL: 'del' is a reserved keyword in the Python syntax. Therefore redis-py
+ uses 'delete' instead.
+* CONFIG GET|SET: These are implemented separately as config_get or config_set.
+* MULTI/EXEC: These are implemented as part of the Pipeline class. Calling
+ the pipeline method and specifying use_transaction=True will cause the
+ pipeline to be wrapped with the MULTI and EXEC statements when it is executed.
+ See more about Pipelines below.
+* SUBSCRIBE/LISTEN: Similar to pipelines, PubSub is implemented as a separate
+ class as it places the underlying connection in a state where it can't
+ execute non-pubsub commands. Calling the pubsub method from the Redis client
+ will return a PubSub instance where you can subscribe to channels and listen
+ for messages. You can call PUBLISH from both classes.
+
+In addition to the changes above, the Redis class, a subclass of StrictRedis,
+overrides several other commands to provide backwards compatibility with older
+versions of redis-py:
+
+* LREM: Order of 'num' and 'value' arguments reversed such that 'num' can
+ provide a default value of zero.
+* ZADD: Redis specifies the 'score' argument before 'value'. These were swapped
+ accidentally when being implemented and not discovered until after people
+ were already using it. The Redis class expects *args in the form of:
+ name1, score1, name2, score2, ...
+
+
## More Detail
### Connection Pools
@@ -232,35 +266,6 @@ which is much easier to read:
>>> r.transaction(client_side_incr, 'OUR-SEQUENCE-KEY')
[True]
-
-## API Reference
-
-The official Redis documentation does a great job of explaining each command in
-detail (http://redis.io/commands). In most cases, redis-py uses the same
-arguments as the official spec. There are a few exceptions noted here:
-
-* SELECT: Not implemented. See the explanation in the Thread Safety section
- above.
-* ZADD: Redis specifies the 'score' argument before 'value'. These were swapped
- accidentally when being implemented and not discovered until after people
- were already using it. As of Redis 2.4, ZADD will start supporting variable
- arguments. redis-py implements these as python keyword arguments where the
- name is the 'value' and the value is the 'score'.
-* DEL: 'del' is a reserved keyword in the Python syntax. Therefore redis-py
- uses 'delete' instead.
-* CONFIG GET|SET: These are implemented separately as config_get or config_set.
-* MULTI/EXEC: These are implemented as part of the Pipeline class. Calling
- the pipeline method and specifying use_transaction=True will cause the
- pipeline to be wrapped with the MULTI and EXEC statements when it is executed.
- See more about Pipelines above.
-* SUBSCRIBE/LISTEN: Similar to pipelines, PubSub is implemented as a separate
- class as it places the underlying connection in a state where it can't
- execute non-pubsub commands. Calling the pubsub method from the Redis client
- will return a PubSub instance where you can subscribe to channels and listen
- for messages. You can call PUBLISH from both classes.
-* LREM: Order of 'num' and 'value' arguments reversed such that 'num' can
- provide a default value of zero.
-
## Versioning scheme
redis-py is versioned after Redis. For example, redis-py 2.0.0 should