def get_sharded_config(cls, name):
cache_key = ShardedCounterConfig.cache_key(name)
config = memcache.get(cache_key)
if not config:
''' Try fetching from datastore '''
config = ShardedCounterConfig.get_or_insert(name, name=name, shards=20)
memcache.set(cache_key, config, time=86400)
return config
评论列表
文章目录