Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

-- restructuredtext --

The repoze.what Redis plugin

This is an adapters plugin for repoze.what

The Redis plugin makes repoze.what support sources defined in Redis key-value databases by providing one group adapter and one permission adapter.

Redis

Redis is a key-value database. It is similar to memcached but the dataset is not volatile, and values can be strings, exactly like in memcached, but also lists and sets with atomic operations to push/pop elements.

In order to be very fast but at the same time persistent the whole dataset is taken in memory and from time to time and/or when a number of changes to the dataset are performed it is written asynchronously on disk.

The database name is numeric; the default database is 0.

repoze.what.plugin.redis uses database 1 for the group adapter and database 2 for the permission adapter by default, but it lets a custom name in the adapter initialization.

Building

To compile the trunk version:

$ git clone git://github.com/antirez/redis.git
$ cd redis
$ make

To update:

$ git pull && make clean && make

To run the server:

$ ./redis-server

The Python library is in ./client-libraries/python/, so you should copy it into your site-packages, e.g.:

cp ./client-libraries/python/redis.py your-ve/lib/python2.6/site-packages/

Note: The client-libraries directory inside the Redis distribution is only a temp thing.

Little issues

  • If the client is disconnected after of some time of inactivity --it's configured to 300 seconds by default--, and it's called any command then it raises a ConnectionError. It should be rather managed from the Python driver:

    http://groups.google.com/group/redis-db/browse_thread/thread/2581396a6722d3f9

  • The data are synchronously saved. It could be modified the _save function (in the Redis adapter) for that it been asynchronously saved, or for that it been saved only when a number of changes to the dataset are performed.

Use

Typical usage:

>>> import redis
>>> from repoze.what.plugins.redis import adapters
>>> group = adapters.RedisGroupAdapter(redis.Redis())
>>> permission = adapters.RedisPermissionAdapter(redis.Redis())

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.