コード例 #1
0
ファイル: memcache.py プロジェクト: sh4nks/flask-caching
    def set_many(self, mapping, timeout=None):
        new_mapping = {}
        for key, value in iteritems_wrapper(mapping):
            key = self._normalize_key(key)
            new_mapping[key] = value

        timeout = self._normalize_timeout(timeout)
        failed_keys = self._client.set_multi(new_mapping, timeout)
        return not failed_keys
コード例 #2
0
ファイル: memcache.py プロジェクト: rkjaran/flask-caching
    def set_many(self, mapping, timeout=None):
        new_mapping = {}
        for key, value in iteritems_wrapper(mapping):
            key = self._normalize_key(key)
            new_mapping[key] = value

        timeout = self._normalize_timeout(timeout)
        failed_keys = self._client.set_multi(new_mapping, timeout)
        return not failed_keys
コード例 #3
0
ファイル: rediscache.py プロジェクト: sh4nks/flask-caching
    def set_many(self, mapping, timeout=None):
        timeout = self._normalize_timeout(timeout)
        # Use transaction=False to batch without calling redis MULTI
        # which is not supported by twemproxy
        pipe = self._write_client.pipeline(transaction=False)

        for key, value in iteritems_wrapper(mapping):
            dump = self.dump_object(value)
            if timeout == -1:
                pipe.set(name=self.key_prefix + key, value=dump)
            else:
                pipe.setex(name=self.key_prefix + key, value=dump, time=timeout)
        return pipe.execute()
コード例 #4
0
ファイル: rediscache.py プロジェクト: oliverh100/coursework
    def set_many(self, mapping, timeout=None):
        timeout = self._normalize_timeout(timeout)
        # Use transaction=False to batch without calling redis MULTI
        # which is not supported by twemproxy
        pipe = self._write_client.pipeline(transaction=False)

        for key, value in iteritems_wrapper(mapping):
            dump = self.dump_object(value)
            if timeout == -1:
                pipe.set(name=self._get_prefix() + key, value=dump)
            else:
                pipe.setex(name=self._get_prefix() + key,
                           value=dump,
                           time=timeout)
        return pipe.execute()