Esempio n. 1
0
 def save(self):
     if not self.is_expires:
         log.debug(u'[{2}][缓存]{0}:{1}'.format(self.key, self.value,
                                              to_datetime(self.expired_at)))
         # times秒数如果大于30天,则需传入到期时间的时间戳(且必须为整数)
         cache.set(self.key, self.value, int(self.expired_at))
Esempio n. 2
0
 def test_timestamp(self):
     ts = time.time()
     dt = to_datetime(ts)
     self.assertEqual(int(ts), to_timestamp(dt))
Esempio n. 3
0
 def save(self):
     if not self.is_expires:
         log.debug(u"[{2}][缓存]{0}:{1}".format(self.key, self.value, to_datetime(self.expired_at)))
         # times秒数如果大于30天,则需传入到期时间的时间戳(且必须为整数)
         cache.set(self.key, self.value, int(self.expired_at))