當前位置: 首頁>>代碼示例>>Python>>正文


Python memcache.Client方法代碼示例

本文整理匯總了Python中google.appengine.api.memcache.Client方法的典型用法代碼示例。如果您正苦於以下問題:Python memcache.Client方法的具體用法?Python memcache.Client怎麽用?Python memcache.Client使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在google.appengine.api.memcache的用法示例。


在下文中一共展示了memcache.Client方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: import_preferred_memcache_lib

# 需要導入模塊: from google.appengine.api import memcache [as 別名]
# 或者: from google.appengine.api.memcache import Client [as 別名]
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 
開發者ID:jojoin,項目名稱:cutout,代碼行數:27,代碼來源:memcachedcache.py

示例2: import_preferred_memcache_lib

# 需要導入模塊: from google.appengine.api import memcache [as 別名]
# 或者: from google.appengine.api.memcache import Client [as 別名]
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)

        try:
            import libmc
        except ImportError:
            pass
        else:
            return libmc.Client(servers)


# backwards compatibility 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:34,代碼來源:cache.py

示例3: _GetXsrfKey

# 需要導入模塊: from google.appengine.api import memcache [as 別名]
# 或者: from google.appengine.api.memcache import Client [as 別名]
def _GetXsrfKey():
  """Returns the current key for generating and verifying XSRF tokens."""
  client = memcache.Client()
  xsrf_key = client.get('xsrf_key')
  if not xsrf_key:
    config = models.GetApplicationConfiguration()
    xsrf_key = config.xsrf_key
    client.set('xsrf_key', xsrf_key)
  return xsrf_key 
開發者ID:google,項目名稱:gae-secure-scaffold-python,代碼行數:11,代碼來源:handlers.py

示例4: bump_counter

# 需要導入模塊: from google.appengine.api import memcache [as 別名]
# 或者: from google.appengine.api.memcache import Client [as 別名]
def bump_counter(key, time=3600, limit=4):
  client = memcache.Client()
  for _ in range(limit):
    counter = client.gets(key)
    if counter is None:
      client.set(key, 0, time=time)
      counter = 0
    if client.cas(key, counter + 1):
      break


###############################################################################
# Auth Attempts stuff
############################################################################### 
開發者ID:lipis,項目名稱:github-stats,代碼行數:16,代碼來源:cache.py

示例5: reset_auth_attempt

# 需要導入模塊: from google.appengine.api import memcache [as 別名]
# 或者: from google.appengine.api.memcache import Client [as 別名]
def reset_auth_attempt():
  client = memcache.Client()
  client.set(get_auth_attempt_key(), 0, time=3600) 
開發者ID:lipis,項目名稱:github-stats,代碼行數:5,代碼來源:cache.py

示例6: get_auth_attempt

# 需要導入模塊: from google.appengine.api import memcache [as 別名]
# 或者: from google.appengine.api.memcache import Client [as 別名]
def get_auth_attempt():
  client = memcache.Client()
  return client.get(get_auth_attempt_key()) or 0 
開發者ID:lipis,項目名稱:github-stats,代碼行數:5,代碼來源:cache.py

示例7: import_preferred_memcache_lib

# 需要導入模塊: from google.appengine.api import memcache [as 別名]
# 或者: from google.appengine.api.memcache import Client [as 別名]
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)

        try:
            import libmc
        except ImportError:
            pass
        else:
            return libmc.Client(servers) 
開發者ID:pallets,項目名稱:cachelib,代碼行數:31,代碼來源:memcached.py


注:本文中的google.appengine.api.memcache.Client方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。