当前位置: 首页>>代码示例>>Python>>正文


Python Client.flush_all方法代码示例

本文整理汇总了Python中pymemcache.client.base.Client.flush_all方法的典型用法代码示例。如果您正苦于以下问题:Python Client.flush_all方法的具体用法?Python Client.flush_all怎么用?Python Client.flush_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymemcache.client.base.Client的用法示例。


在下文中一共展示了Client.flush_all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_incr_decr

# 需要导入模块: from pymemcache.client.base import Client [as 别名]
# 或者: from pymemcache.client.base.Client import flush_all [as 别名]
def test_incr_decr(client_class, host, port, socket_module):
    client = Client((host, port), socket_module=socket_module)
    client.flush_all()

    result = client.incr(b'key', 1, noreply=False)
    assert result is None

    result = client.set(b'key', b'0', noreply=False)
    assert result is True
    result = client.incr(b'key', 1, noreply=False)
    assert result == 1

    def _bad_int():
        client.incr(b'key', b'foobar')

    with pytest.raises(MemcacheClientError):
        _bad_int()

    result = client.decr(b'key1', 1, noreply=False)
    assert result is None

    result = client.decr(b'key', 1, noreply=False)
    assert result == 0
    result = client.get(b'key')
    assert result == b'0'
开发者ID:ewdurbin,项目名称:pymemcache,代码行数:27,代码来源:test_integration.py

示例2: test_serialization_deserialization

# 需要导入模块: from pymemcache.client.base import Client [as 别名]
# 或者: from pymemcache.client.base.Client import flush_all [as 别名]
def test_serialization_deserialization(host, port, socket_module):
    def _ser(key, value):
        return json.dumps(value).encode('ascii'), 1

    def _des(key, value, flags):
        if flags == 1:
            return json.loads(value.decode('ascii'))
        return value

    client = Client((host, port), serializer=_ser, deserializer=_des,
                    socket_module=socket_module)
    client.flush_all()

    value = {'a': 'b', 'c': ['d']}
    client.set(b'key', value)
    result = client.get(b'key')
    assert result == value
开发者ID:ewdurbin,项目名称:pymemcache,代码行数:19,代码来源:test_integration.py

示例3: test_misc

# 需要导入模块: from pymemcache.client.base import Client [as 别名]
# 或者: from pymemcache.client.base.Client import flush_all [as 别名]
def test_misc(client_class, host, port, socket_module):
    client = Client((host, port), socket_module=socket_module)
    client.flush_all()
开发者ID:ewdurbin,项目名称:pymemcache,代码行数:5,代码来源:test_integration.py

示例4: memcached

# 需要导入模块: from pymemcache.client.base import Client [as 别名]
# 或者: from pymemcache.client.base.Client import flush_all [as 别名]
    def memcached(self, host, port):
        memcached = Client((host, port))

        yield memcached

        memcached.flush_all()
开发者ID:drgarcia1986,项目名称:simple-settings,代码行数:8,代码来源:test_memcached.py


注:本文中的pymemcache.client.base.Client.flush_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。