Пример #1
0
    def _assert_set_with_timeout_milliseconds(self, milliseconds):
        """Assert that psetex sets a key with a value along with a timeout"""

        eq_(None, self.redis.get('key'))

        ok_(self.redis.psetex('key', milliseconds, 'value'))
        eq_('value', self.redis.get('key'))

        ok_(self.redis.pttl('key'), "expiration was not set correctly")
        if isinstance(milliseconds, timedelta):
            milliseconds = get_total_milliseconds(milliseconds)

        ok_(0 < self.redis.pttl('key') <= milliseconds)
Пример #2
0
    def _assert_set_with_timeout_milliseconds(self, milliseconds):
        """Assert that psetex sets a key with a value along with a timeout"""

        eq_(None, self.redis.get('key'))

        ok_(self.redis.psetex('key', milliseconds, 'value'))
        eq_('value', self.redis.get('key'))

        ok_(self.redis.pttl('key'), "expiration was not set correctly")
        if isinstance(milliseconds, timedelta):
            milliseconds = get_total_milliseconds(milliseconds)

        ok_(0 < self.redis.pttl('key') <= milliseconds)