skip to navigation
skip to content

Not Logged In

gmemcache 0.0.2

A gevent-compatible Memcached Python client with binary protocol and consistent hashing support

Latest Version: 0.0.5

A gevent-compatible Memcached Python client with binary protocol and consistent hashing support.

Currently, only the following four methods are supported:

  • get
  • get_multi
  • set
  • set_multi

Installation

$ pip install Cython
$ pip install gmemcache

Basic Usage

>>> from gmemcache import MemcacheConnection
>>> client = MemcacheConnection(['127.0.0.1:11211'])
>>> client.is_connected()
True
>>> client.set_multi({'key1': 'value1', 'key2': 'value2'})
True
>>> client.get_multi(['key1', 'key2', 'key3'])
{'key1': u'value1', 'key2': u'value2'}
>>> client.close()

Using with gsocketpool

>>> from gmemcache import MemcachePoolConnection
>>> from gsocketpool import Pool
>>> pool = Pool(MemcachePoolConnection, dict(hosts=['127.0.0.1:11211']))
>>> with pool.connection() as client:
...   client.is_connected()
...   client.set_multi({'key1': 'value1', 'key2': 'value2'})
...   client.get_multi(['key1', 'key2', 'key3'])
True
True
{'key2': u'value2', 'key1': u'value1'}
 
File Type Py Version Uploaded on Size
gmemcache-0.0.2.tar.gz (md5) Source 2014-03-06 4KB
  • Downloads (All Versions):
  • 33 downloads in the last day
  • 123 downloads in the last week
  • 343 downloads in the last month
  • Author: Studio Ousia
  • Home Page: http://github.com/studio-ousia/gmemcache/
  • License:
    Copyright 2013 Studio Ousia
    
       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at
    
           http://www.apache.org/licenses/LICENSE-2.0
    
       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.
  • Package Index Owner: ousia, ikuyamada
  • Package Index Maintainer: ikuyamada
  • DOAP record: gmemcache-0.0.2.xml