How to use the pymemcache.client.Client function in pymemcache

To help you get started, we’ve selected a few pymemcache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jxtech / wechatpy / tests / test_session.py View on Github external
def test_memcached_storage_init(self):
        if platform.system() == 'Windows':
            return

        from pymemcache.client import Client
        from wechatpy.session.memcachedstorage import MemcachedStorage

        servers = ("127.0.0.1", 11211)
        memcached = Client(servers)
        session = MemcachedStorage(memcached)
        client = WeChatClient(self.app_id, self.secret, session=session)
        self.assertTrue(isinstance(client.session, MemcachedStorage))
github youknowone / ring / tests / test_func_sync.py View on Github external
import sys
import ring
import pymemcache.client
import memcache
import redis
import diskcache

import pytest


pymemcache_client = pymemcache.client.Client(('127.0.0.1', 11211))
pythonmemcache_client = memcache.Client(["127.0.0.1:11211"])
redis_py_client = redis.StrictRedis()


try:
    import pylibmc
except ImportError:
    pylibmc_client = None
else:
    pylibmc_client = pylibmc.Client(['127.0.0.1'])


class StorageDict(dict):
    pass
github youknowone / ring / tests / test_func_sync.py View on Github external
import sys
import time
import shelve
import ring
import pymemcache.client
import memcache
import redis
import diskcache
from ring.func.lru_cache import LruCache

import pytest
from pytest_lazyfixture import lazy_fixture


pymemcache_client = pymemcache.client.Client(('127.0.0.1', 11211))
pythonmemcache_client = memcache.Client(["127.0.0.1:11211"])
redis_py_client = redis.StrictRedis()


try:
    import pylibmc
except ImportError:
    pylibmc_client = None
else:
    pylibmc_client = pylibmc.Client(['127.0.0.1'])


class StorageDict(dict):
    pass
github alisaifee / flask-limiter / tests / test_strategy.py View on Github external
def setUp(self):
        redis.Redis().flushall()
        pymemcache.client.Client(('localhost', 11211)).flush_all()
github jxtech / wechatpy / tests / test_session.py View on Github external
def test_memcached_storage_access_token(self):
        if platform.system() == 'Windows':
            return

        from pymemcache.client import Client
        from wechatpy.session.memcachedstorage import MemcachedStorage

        servers = ("127.0.0.1", 11211)
        memcached = Client(servers)
        session = MemcachedStorage(memcached)
        client = WeChatClient(self.app_id, self.secret, session=session)
        with HTTMock(wechat_api_mock):
            token = client.fetch_access_token()
            self.assertEqual('1234567890', token['access_token'])
            self.assertEqual(7200, token['expires_in'])
            self.assertEqual('1234567890', client.access_token)
github 007gzs / dingtalk-sdk / tests / test_storage.py View on Github external
def test_memcache_storage(self):
        from pymemcache.client import Client
        from dingtalk.storage.kvstorage import KvStorage
        servers = ("127.0.0.1", 11211)
        memcached = Client(servers)
        storage = KvStorage(memcached)
        self.test_caches(storage)
github duk3luk3 / onion-py / onion_py / caching.py View on Github external
def __init__(self, host=('localhost', 11211)):
    try:
      from pymemcache.client import Client
      self.memcached_client = Client(host, serializer=json_serializer, deserializer=json_deserializer)
    except ImportError:
      raise DependencyError("Error importing pymemcache library for OnionMemcached")
github stormpath / stormpath-sdk-python / stormpath / cache / memcached_store.py View on Github external
def __init__(self, host='localhost', port=11211,
            connect_timeout=None, timeout=None,
            no_delay=False, ignore_exc=True,
            key_prefix=b'', socket_module=socket, ttl=DEFAULT_TTL):
        self.ttl = ttl

        try:
            from pymemcache.client import Client as Memcache
        except ImportError:
            raise RuntimeError('Memcached support is not available. Run "pip install pymemcache".')

        self.memcache = Memcache(
                (host, port),
                serializer=json_serializer,
                deserializer=json_deserializer,
                connect_timeout=connect_timeout,
                timeout=timeout,
                socket_module=socket_module,
                no_delay=no_delay,
                ignore_exc=ignore_exc,
                key_prefix=key_prefix)