""" """ from wheezy.caching.patterns import Cached from wheezy.caching.patterns import key_builder from config import cache from public.repository import keys kb = key_builder(key_prefix='pub') cached = Cached(cache, kb, time=3600 * 24, namespace='public') class QuoteRepository(object): def __init__(self, inner): self.inner = inner @cached(make_key=keys.get_daily_quote) def get_daily_quote(self): return self.inner.get_daily_quote()
""" """ from wheezy.caching.patterns import Cached from wheezy.caching.patterns import key_builder from config import cache from membership.repository import keys kb = key_builder(key_prefix='mbr') cached = Cached(cache, kb, time=3600 * 24, namespace='membership') cached_long = Cached(cache, kb, time=3600, namespace='membership') class MembershipRepository(object): def __init__(self, inner): self.inner = inner @cached def list_password_questions(self, locale): return self.inner.list_password_questions(locale) def authenticate(self, credential): # TODO: return self.inner.authenticate(credential) def has_account(self, username): # key = keys.has_account(username) # result = cache.get(key)