Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 0e2b7d294b
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (25 sloc) 1.081 kb
# Courtesy of:
import logging
from beaker_nosql import *
from pytyrant import PyTyrant
except ImportError:
raise InvalidCacheBackendError("PyTyrant cache backend requires the 'pytyrant' library")
log = logging.getLogger(__name__)
class TokyoTyrantManager(NoSqlManager):
def __init__(self, namespace, url=None, data_dir=None, lock_dir=None, **params):
NoSqlManager.__init__(self, namespace, url=url, data_dir=data_dir, lock_dir=lock_dir, **params)
def open_connection(self, host, port):
self.db_conn =, int(port))
def __contains__(self, key):
return self.db_conn.has_key(self._format_key(key))
def set_value(self, key, value):
self.db_conn[self._format_key(key)] = pickle.dumps(value)
def __delitem__(self, key):
del self.db_conn[self._format_key(key)]
def do_remove(self):
def keys(self):
return self.db_conn.keys()
class TokyoTyrantContainer(Container):
namespace_manager = TokyoTyrantManager
Jump to Line
Something went wrong with that request. Please try again.