def update(cls, domain, time=0):
"""
Updates the memcached stats for a given domain
This is used when a report is updated so that memcached
has the current stats.
Args:
domain - str - The domain to use for the namespace
time - int - The timeout for stored keys (default: 5 seconds)
"""
namespace = "{}|{}".format('stats', domain)
for status in VALID_STATUSES:
count = EmailReport.query(EmailReport.reported_domain == domain,
EmailReport.status == status).count()
memcache.set(
key=status, namespace=namespace, value=count, time=time)
评论列表
文章目录