A memcache like client for Riak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Brett Langdon 0b026c32b7 add PyPI downloads badge 12 years ago
docs add usage and installation examples to readme 12 years ago
riakcached add documentation for riakcached.exceptions 12 years ago
.gitignore ignore unimportant docs directories 12 years ago
.travis.yml setup coveralls coverage reporting 12 years ago
LICENSE.txt initial commit 12 years ago
MANIFEST.ini initial commit 12 years ago
README.md add PyPI downloads badge 12 years ago
docs-requirements.txt s/sphinx-contrib-fulltoc/sphinxcontrib-fulltoc 12 years ago
requirements.txt fix requirements and test requirements 12 years ago
setup.py remove long_description 12 years ago
test-requirements.txt use unittest2 for python2.6 12 years ago

README.md

Riakcached

Build Status Coverage Status PyPI version Downloads

A Memcached like interface to the Riak HTTP Client. Read The Docs

Installing

From PyPI

pip install riakcached

From Git

git clone git://github.com/brettlangdon/riakcached.git
cd ./riakcached
pip install -r requirements.txt
python setup.py install

Usage

Basic Usage

from riakcached.clients import RiakClient

client = RiakClient("my_bucket")

client.set("hello", "world")
print client.get("hello")
# 'hello'

client.delete("hello")
print client.get("hello")
# None

values = {
    "hello": "world",
    "foo": "bar",
}
client.set_many(values)

keys = ["hello", "foo", "test"]
print client.get_many(keys)
# {'foo': 'bar', 'hello': 'world'}

client.close()

Connection Pool Settings

from riakcached.clients import RiakClient
from riakcached.pools import Urllib3Pool

pool = Urllib3Pool(base_url="http://my-host.com:8098/", timeout=1)
client = RiakClient("my_bucket", pool=pool)

client.get("foo")

Custom Connection Pool

from riakcached.clients import RiakClient
from riakcache.pools import Pool

class CustomPool(Pool):
    __slots__ = ["connection"]

    def connect(self):
        self.connection = make_a_connection()

    def close(self):
        if self.connection:
            close_connection(self.connection)

    def request(self, method, url, body=None, headers=None):
        results = make_request(self.connection, method, url, body, headers, timeout=self.timeout)
        return results.status, results.data, results.headers


custom_pool = CustomPool(base_url="http://my-host.com:8098", timeout=1)
client = RiakClient("my_bucket", pool=pool)

Threaded Client

The exists a riakcached.clients.ThreadedRiakClient which inherits from riakcached.clients.RiakClient and which uses threading to try to parallelize calls to get_many, set_many and delete_many.

Documentation

The documentation can be found in the /docs directory in this repository and should be fairly complete for the codebase.

Building Documentation

git clone git://github.com/brettlangdon/riakcached.git
cd riakcached
pip install -r docs-requirements.txt
cd ./docs
make html