我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用pylibmc.Client()。
def import_preferred_memcache_lib(self, servers): """Returns an initialized memcache client. Used by the constructor.""" try: import pylibmc except ImportError: pass else: return pylibmc.Client(servers) try: from google.appengine.api import memcache except ImportError: pass else: return memcache.Client() try: import memcache except ImportError: pass else: return memcache.Client(servers) # backwards compatibility
def init_memcache(): client = pylibmc.Client([keys.get('redis_memcache_endpoint')], binary=True, username='dancedeets', password=keys.get('redis_memcache_password')) # Non-existent functions necessary to adhere to the memcache API expected by gae_memcache's setup_client() client.set_servers = None client.forget_dead_hosts = None client.debuglog = None client.replace_multi = None client.offset_multi = None if gae_memcache: # Try to use this redis memcache for all GAE stuff seamlessly gae_memcache.setup_client(client) return client