コード例 #1
0
ファイル: helpers.py プロジェクト: fiatjaf/formspree
def increase_monthly_counter(form_id, basedate=None):
    basedate = basedate or datetime.datetime.now()
    month = basedate.month
    key = REDIS_COUNTER_KEY(form_id=form_id, month=month)
    counter = redis_store.incr(key)
    redis_store.expireat(key, unix_time_for_12_months_from_now(basedate))
    return int(counter)
コード例 #2
0
ファイル: helpers.py プロジェクト: araphiel/formspree
def increase_monthly_counter(form_id, basedate=None):
    basedate = basedate or datetime.datetime.now()
    month = basedate.month
    key = REDIS_COUNTER_KEY(form_id=form_id, month=month)
    counter = redis_store.incr(key)
    redis_store.expireat(key, unix_time_for_12_months_from_now(basedate))
    return int(counter)
コード例 #3
0
ファイル: models.py プロジェクト: MorphiusInfotech/formspree
 def increase_monthly_counter(self, basedate=None):
     basedate = basedate or datetime.datetime.now()
     month = basedate.month
     key = MONTHLY_COUNTER_KEY(form_id=self.id, month=month)
     redis_store.incr(key)
     redis_store.expireat(key, unix_time_for_12_months_from_now(basedate))
コード例 #4
0
 def increase_monthly_counter(self, basedate=None):
     basedate = basedate or datetime.datetime.now()
     month = basedate.month
     key = MONTHLY_COUNTER_KEY(form_id=self.id, month=month)
     redis_store.incr(key)
     redis_store.expireat(key, unix_time_for_12_months_from_now(basedate))