Permalink
Browse files

Merge pull request #16 from andrewzeneski/master

Fixes for Riak
  • Loading branch information...
didip committed Feb 26, 2013
2 parents d0006ca + b74e429 commit d5fde77c10f993c63694c99439b9494ffc724ddd
Showing with 14 additions and 6 deletions.
  1. +1 −1 README.md
  2. +12 −4 beaker_extensions/{riak.py → riak_.py}
  3. +1 −1 setup.py
View
@@ -3,7 +3,7 @@
Install directly from git using PIP:
```
-pip install git+git://github.com/didip/beaker_extensions.git
+pip install git+git://github.com/andrewzeneski/beaker_extensions.git
```
Now you can use the redis, tyrant, riak, dynomite, and ringo extensions.
@@ -23,16 +23,24 @@ def open_connection(self, host, port):
self.bucket = self.db_conn.bucket('beaker_cache')
def __contains__(self, key):
- return self.bucket.get(key).exists()
+ return self.bucket.get(self._format_key(key)).exists()
def set_value(self, key, value):
- self.bucket.new(key, value).store()
+ val = self.bucket.get(self._format_key(key))
+ if not val.exists():
+ self.bucket.new(self._format_key(key), value).store()
+ else:
+ val.set_data(value)
+ val.store()
def __getitem__(self, key):
- return self.bucket.get(key)
+ return self.bucket.get(self._format_key(key)).get_data()
def __delitem__(self, key):
- self.bucket.get(key).delete()
+ self.bucket.get(self._format_key(key)).delete()
+
+ def _format_key(self, key):
+ return 'beaker:%s:%s' % (self.namespace, key.replace(' ', '\302\267'))
def do_remove(self):
raise Exception("Unimplemented")
View
@@ -25,7 +25,7 @@
[beaker.backends]
redis = beaker_extensions.redis_:RedisManager
tyrant = beaker_extensions.tyrant_:TokyoTyrantManager
- riak = beaker_extensions.riak:RiakManager
+ riak = beaker_extensions.riak_:RiakManager
dynomite = beaker_extensions.dynomite_:DynomiteManager
ringo = beaker_extensions.ringo:RingoManager
cassandra = beaker_extensions.cassandra:CassandraManager

0 comments on commit d5fde77

Please sign in to comment.