当前位置: 首页>>代码示例>>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;未经允许,请勿转载。