def __init__(self, archive, algorithm='lru:///', serializer='none:///', cache='memory:///', key_transform=None):
        # Construct modules
        self.archive = ModuleManager.construct(self, 'archive', archive)
        self.algorithm = ModuleManager.construct(self, 'algorithm', algorithm)
        self.serializer = ModuleManager.construct(self, 'serializer', serializer)
        self.cache = ModuleManager.construct(self, 'cache', cache)

        self.key_transform = key_transform or (lambda key: key, lambda key: key)

        self._flushing = Lock()
Exemple #2
0
    def __init__(self,
                 archive,
                 algorithm='lru:///',
                 serializer='none:///',
                 cache='memory:///',
                 key_transform=None):
        # Construct modules
        self.archive = ModuleManager.construct(self, 'archive', archive)
        self.algorithm = ModuleManager.construct(self, 'algorithm', algorithm)
        self.serializer = ModuleManager.construct(self, 'serializer',
                                                  serializer)
        self.cache = ModuleManager.construct(self, 'cache', cache)

        self.key_transform = key_transform or (lambda key: key,
                                               lambda key: key)

        self._flushing = Lock()
Exemple #3
0
    def __init__(cls, *args, **kwargs):
        if not cls.__module__.endswith('.base'):
            ModuleManager.register(cls)

        super(ModuleMeta, cls).__init__(*args, **kwargs)