Skip to content

Commit

Permalink
ref(namespacing): add namespacing support to pubsub, redis, strict,
Browse files Browse the repository at this point in the history
pipeline as decorators
  • Loading branch information
exit99 committed May 26, 2016
1 parent fac5cf5 commit adec138
Show file tree
Hide file tree
Showing 7 changed files with 440 additions and 1,730 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dump.rdb
_build
vagrant/.vagrant
.python-version
.cache/
28 changes: 27 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,33 @@ Namespacing
>>> r.get('foo')
'bar'
Important: Any application code that accesses data structures that store
key names will not return keys with the namespace stripped. For example:

.. code-block:: pycon
r = redis.StrictRedis(namespace="ns:", ...)
for key in r.blpop():
data = r.get(key)
# do something with data
# if data is a key it will not have the namespace removed
### OR
for key in r.keys('myapp:*'):
data = r.get(key)
To strip the namespace from the keys manually you can use the `remove_namespace`
function.

.. code-block:: pycon
r = redis.StrictRedis(namespace="ns:", ...)
for key in r.keys('myapp:*'):
data = r.remove_namespace(r.get(key))
Author
^^^^^^

Expand All @@ -684,4 +711,3 @@ Special thanks to:
which some of the socket code is still used.
* Alexander Solovyov for ideas on the generic response callback system.
* Paul Hubbard for initial packaging support.

0 comments on commit adec138

Please sign in to comment.