Пример #1
0
 def increase_monthly_counter(self, basedate=None):
     basedate = basedate or datetime.datetime.now()
     month = basedate.month
     key = REDIS_COUNTER_KEY(form_id=self.id, month=month)
     redis_store.incr(key)
     redis_store.expireat(key, unix_time_for_12_months_from_now(basedate))
Пример #2
0
 def get_monthly_counter(self, basedate=None):
     basedate = basedate or datetime.datetime.now()
     month = basedate.month
     key = REDIS_COUNTER_KEY(form_id=self.id, month=month)
     counter = redis_store.get(key) or 0
     return int(counter)