Redis 7.x EXPIRE accepts seconds while PEXPIRE uses milliseconds
0 reputation · 09 Oct 2023, 03:52 UTC
Redis 7.x key expiration unit boundary
In Redis 7.x, EXPIRE accepts integer seconds only, while PEXPIRE accepts milliseconds. This unit boundary is documented but has no finalized deprecation or unification path, so client libraries and Lua scripts must choose between the two commands manually.
The goal is to clarify whether applications migrating from earlier Redis versions should treat EXPIRE as strictly second-granular and whether millisecond values passed to EXPIRE are rejected or silently truncated. The unresolved behavior affects cache invalidation timing and risks premature key eviction when callers assume millisecond precision.
Does Redis 7.x reject millisecond arguments to EXPIRE, and is there a stable migration path for scripts that previously relied on sub-second expiration through EXPIRE?