Follow memcached's convention where a timeout greater than 30 days is treated as an absolute expiration timestamp instead of a relative offset (#12399).
(self)
| 624 | self.assertIsNone(cache.get("key2")) |
| 625 | |
| 626 | def test_long_timeout(self): |
| 627 | """ |
| 628 | Follow memcached's convention where a timeout greater than 30 days is |
| 629 | treated as an absolute expiration timestamp instead of a relative |
| 630 | offset (#12399). |
| 631 | """ |
| 632 | cache.set("key1", "eggs", 60 * 60 * 24 * 30 + 1) # 30 days + 1 second |
| 633 | self.assertEqual(cache.get("key1"), "eggs") |
| 634 | |
| 635 | self.assertIs(cache.add("key2", "ham", 60 * 60 * 24 * 30 + 1), True) |
| 636 | self.assertEqual(cache.get("key2"), "ham") |
| 637 | |
| 638 | cache.set_many( |
| 639 | {"key3": "sausage", "key4": "lobster bisque"}, 60 * 60 * 24 * 30 + 1 |
| 640 | ) |
| 641 | self.assertEqual(cache.get("key3"), "sausage") |
| 642 | self.assertEqual(cache.get("key4"), "lobster bisque") |
| 643 | |
| 644 | @retry() |
| 645 | def test_forever_timeout(self): |