Exemplo n.º 1
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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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]
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 9
0
 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]
Exemplo n.º 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')
Exemplo n.º 11
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')
Exemplo n.º 12
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)

        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])
Exemplo n.º 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])
Exemplo n.º 14
0
 def __init__(self, table=None, params=None):
     BaseStorage.__init__(self, params)
     self._model = DjangoKVStore
Exemplo n.º 15
0
 def __init__(self, server, params):
     BaseStorage.__init__(self, params)
     self._db = memcache.Client(server.split(";"))
Exemplo n.º 16
0
 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')
Exemplo n.º 17
0
 def __init__(self, server, params):
     BaseStorage.__init__(self, params)
     self._db = memcache.Client(server.split(';'))
Exemplo n.º 18
0
 def __init__(self, _, params):
     BaseStorage.__init__(self, params)
     self._db = {}
     self._lock = RWLock()
Exemplo n.º 19
0
 def __init__(self, _, params):
     BaseStorage.__init__(self, params)
     self._db = {}
     self._lock = RWLock()