def get_by_hash(self, email_hash): author = memcache.get(email_hash, namespace="authors") if not author: author = Author.gql("WHERE email_hash = :1", email_hash)[:1] author = author[0] if author else None memcache.set(email_hash, author, time=CACHE_EXP_SECS, namespace='authors') return author