Memcached 1.6.6 Expiration Semantics: 32‑bit Overflow and 64‑bit Support
0 reputation · 13 May 2020, 20:17 UTC
Goal
To determine a reliable strategy for storing items that must live beyond 30 days in memcached 1.6.6 while avoiding the pitfalls of 32‑bit expiration overflow.
Context and Constraints
Memcached 1.6.6 explicitly documents that expiration values ≤30 days are treated as relative TTLs, whereas values >30 days are interpreted as absolute Unix timestamps. The server stores the expiration as a 32‑bit unsigned integer, which can overflow on 32‑bit builds when the timestamp approaches 2³²‑1. Client libraries that do not perform the TTL/absolute distinction can inadvertently set items that expire immediately or never.
Unresolved Decision
The documentation notes a potential future 64‑bit expiration support, but it is unclear whether and how such a feature will be introduced and how backward compatibility will be maintained.
Questions
- Will memcached ever accept a 64‑bit expiration value, and if so, what syntax or protocol changes will be required?
- How will backward‑compatible clients be affected if the server starts interpreting 64‑bit values?
- What is the safest client‑side approach for setting long‑lived items in the current 32‑bit environment?