我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用google.appengine.api.memcache.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__( self, client_namespace="channel-clients", message_namespace="channel-buckets", channels=None, max_message_backlog=200, pull_retries=37, pull_sleep=1.5, default_cas_ttl=60*30): """ Creates a channel manager """ assert channels self.client_namespace = client_namespace self.message_namespace = message_namespace self.client = memcache.Client() self.default_cas_ttl = default_cas_ttl self.max_message_backlog = max_message_backlog self.channels = channels self.pull_retries = pull_retries self.pull_sleep = pull_sleep
def __init__( self, object_id, prefix="project", namespace="collab", collaborator_expiry=90, online_event_kind=EventKind.PROJECTCOLLABORATORONLINE, offline_event_kind=EventKind.PROJECTCOLLABORATOROFFLINE ): """ Creates an online collaborators manager object_id: the object on which users are collaborating """ self.object_id = object_id self.prefix = prefix self.namespace = namespace self.client = memcache.Client() self.collaborator_expiry = datetime.timedelta( seconds=collaborator_expiry) self.online_event_kind = online_event_kind self.offline_event_kind = offline_event_kind