A session store uses Redis. Each session should expire 30 minutes after the last user activity. Which TTL approach implements this?
- A Set TTL once at creation
- B Use EXPIRE key 1800 on every read/write to reset the idle timeout (correct answer)
- C Use a sorted set with timestamps
- D Use keyspace notifications to detect access
Shortcut: Resetting the TTL (EXPIRE key 1800) on every access implements a sliding expiration. If no activity occurs for 30 minutes, the key naturally expires and the session ends.