コード例 #1
0
ファイル: database_storage.py プロジェクト: 28sui/uliweb
    def __init__(self, cache_manager, options):
        BaseStorage.__init__(self, cache_manager, options)

        self.url = options.get('url', 'sqlite:///')
        self.tablename = options.get('table_name', 'session')
        self.auto_create = options.get('auto_create', True)
        self.db, self.meta, self.table = create_table(self.url, self.tablename, self.auto_create)
コード例 #2
0
 def __init__(self, server, params):
     BaseStorage.__init__(self, params)
     host, port = server.split(':')
     try:
         port = int(port)
     except ValueError:
         raise ImproperlyConfigured("Invalid port provided for tokyo-tyrant key-value store backend")
     self._db = pytyrant.PyTyrant.open(host, port)
コード例 #3
0
    def __init__(self, cache_manager, options):
        BaseStorage.__init__(self, cache_manager, options)

        self.url = options.get('url', 'sqlite:///')
        self.tablename = options.get('table_name', 'session')
        self.auto_create = options.get('auto_create', True)
        self.db, self.meta, self.table = create_table(self.url, self.tablename,
                                                      self.auto_create)
コード例 #4
0
ファイル: redisdj.py プロジェクト: qinshulei/django-kvstore
 def __init__(self, server, params):
     if ':' in server:
         host, port = server.split(':')
         port = int(port)
     else:
         host, port = server, None
     params['port'] = port
     BaseStorage.__init__(self, params)
     self._db = redis.Redis(host=host, **params)
コード例 #5
0
ファイル: redisdj.py プロジェクト: bycoffe/django-kvstore
 def __init__(self, server, params):
     if ':' in server:
         host, port = server.split(':')
         port = int(port)
     else:
         host, port = server, None
     params['port'] = port
     BaseStorage.__init__(self, params)
     self._db = redis.Redis(host=host, **params)
コード例 #6
0
ファイル: sdb.py プロジェクト: JeremyGrosser/goldengate
 def __init__(self, domain, params):
     BaseStorage.__init__(self, params)
     params = dict(params)
     try:
         aws_access_key = params['aws_access_key']
         aws_secret_access_key = params['aws_secret_access_key']
     except KeyError:
         raise ImproperlyConfigured("Incomplete configuration of SimpleDB key-value store. Required parameters: 'aws_access_key', and 'aws_secret_access_key'.")
     self._db = simpledb.SimpleDB(aws_access_key, aws_secret_access_key)
     self._domain = self._db[domain]
コード例 #7
0
 def __init__(self, server, params):
     BaseStorage.__init__(self, params)
     host, port = server.split(':')
     try:
         port = int(port)
     except ValueError:
         raise ImproperlyConfigured(
             "Invalid port provided for tokyo-tyrant key-value store backend"
         )
     self._db = pytyrant.PyTyrant.open(host, port)
コード例 #8
0
 def __init__(self,
              cache_manager,
              options,
              file_dir_name='session_files',
              lock_dir_name='session_files_lock'):
     BaseStorage.__init__(self, cache_manager, options)
     self.data_dir = options.get('data_dir', './sessions')
     self.file_dir = options.get('file_dir') or os.path.join(
         self.data_dir, file_dir_name)
     self.lock_dir = options.get('lock_dir') or os.path.join(
         self.data_dir, lock_dir_name)
コード例 #9
0
ファイル: sdb.py プロジェクト: qinshulei/django-kvstore
 def __init__(self, domain, params):
     BaseStorage.__init__(self, params)
     params = dict(params)
     try:
         aws_access_key = params['aws_access_key']
         aws_secret_access_key = params['aws_secret_access_key']
     except KeyError:
         raise ImproperlyConfigured(
             "Incomplete configuration of SimpleDB key-value store. Required parameters: 'aws_access_key', and 'aws_secret_access_key'."
         )
     self._db = simpledb.SimpleDB(aws_access_key, aws_secret_access_key)
     self._domain = self._db[domain]
コード例 #10
0
    def __init__(self, cache_manager, options):
        """
        options =
            connection = ['localhost:11211']
            module = None
        """
        BaseStorage.__init__(self, cache_manager, options)
        if not options.get('connection'):
            options['connection'] = ['localhost:11211']

        self.client = self.import_preferred_memcache_lib(options)
        if self.client is None:
            raise Error('no memcache module found')
コード例 #11
0
ファイル: memcache_storage.py プロジェクト: 08haozi/uliweb
    def __init__(self, cache_manager, options):
        """
        options =
            connection = ['localhost:11211']
            module = None
        """
        BaseStorage.__init__(self, cache_manager, options)
        if not options.get('connection'):
            options['connection'] = ['localhost:11211']

        self.client = self.import_preferred_memcache_lib(options)
        if self.client is None:
            raise Error('no memcache module found')
コード例 #12
0
ファイル: redis_storage.py プロジェクト: bobgao/uliweb
    def __init__(self, cache_manager, options):
        """
        options =
            unix_socket_path = '/tmp/redis.sock'
            or
            connection_pool = {'host':'localhost', 'port':6379, 'db':0}
        """
        BaseStorage.__init__(self, cache_manager, options)

        if 'unix_socket_path' in options:
            self.client = redis.Redis(unix_socket_path=options['unix_socket_path'])
        else:
            global __connection_pool__
        
            if not __connection_pool__ or __connection_pool__[0] != options['connection_pool']:
                d = {'host':'localhost', 'port':6379}
                d.update(options['connection_pool'])
                __connection_pool__ = (d, redis.ConnectionPool(**d))
            self.client = redis.Redis(connection_pool=__connection_pool__[1])
コード例 #13
0
    def __init__(self, cache_manager, options):
        """
        options =
            unix_socket_path = '/tmp/redis.sock'
            or
            connection_pool = {'host':'localhost', 'port':6379, 'db':0}
        """
        BaseStorage.__init__(self, cache_manager, options)

        self._type = (int, long)
        
        if 'unix_socket_path' in options:
            self.client = redis.Redis(unix_socket_path=options['unix_socket_path'])
        else:
            global __connection_pool__
        
            if not __connection_pool__ or __connection_pool__[0] != options['connection_pool']:
                d = {'host':'localhost', 'port':6379}
                d.update(options['connection_pool'])
                __connection_pool__ = (d, redis.ConnectionPool(**d))
            self.client = redis.Redis(connection_pool=__connection_pool__[1])
コード例 #14
0
 def __init__(self, table=None, params=None):
     BaseStorage.__init__(self, params)
     self._model = DjangoKVStore
コード例 #15
0
ファイル: memcached.py プロジェクト: JeremyGrosser/goldengate
 def __init__(self, server, params):
     BaseStorage.__init__(self, params)
     self._db = memcache.Client(server.split(";"))
コード例 #16
0
ファイル: file_storage.py プロジェクト: bobgao/uliweb
 def __init__(self, cache_manager, options):
     BaseStorage.__init__(self, cache_manager, options)
     self.data_dir = options.get('data_dir', './sessions')
     self.file_dir = options.get('file_dir') or os.path.join(self.data_dir, 'session_files')
     self.lock_dir = options.get('lock_dir') or os.path.join(self.data_dir, 'session_files_lock')
コード例 #17
0
 def __init__(self, server, params):
     BaseStorage.__init__(self, params)
     self._db = memcache.Client(server.split(';'))
コード例 #18
0
ファイル: locmem.py プロジェクト: qinshulei/django-kvstore
 def __init__(self, _, params):
     BaseStorage.__init__(self, params)
     self._db = {}
     self._lock = RWLock()
コード例 #19
0
ファイル: locmem.py プロジェクト: mmalone/django-kvstore
 def __init__(self, _, params):
     BaseStorage.__init__(self, params)
     self._db = {}
     self._lock = RWLock()