Management of differentiated Time-To-Live (TTL) by data type to ensure that temporary data is automatically deleted and to comply with GDPR minimum retention requirements.
When to use
Use in the cache_agent to assign the appropriate TTL to each type of cached data. Biometric data has a strict TTL of 15 minutes per privacy policy.
Instructions
- Define TTLs by type:
- Active session: 15 minutes (
session:{id}) - Cached embeddings: 10 minutes (
embedding:{hash}) - OCR results: 10 minutes (
ocr:{hash}) - Rate limiting counters: 1 hour (
rate:{ip}) - Config/thresholds: 5 minutes (
config:*) - Geo-IP cache: 1 hour (
geoip:{ip})
- Active session: 15 minutes (
- Always use
SET key value EX ttl_seconds. - Never create keys without TTL for session data.
- Check remaining TTL:
TTL key. - Renew TTL on active accesses if necessary:
EXPIRE key ttl. - Monitor keys without TTL: alert if there are session keys without expiration.
Notes
- GDPR requires deletion of biometric data as soon as possible; 15 min is the maximum.
- Use
EXPIREATfor expiration at an absolute timestamp when synchronization is needed. - TTLs are validated in CI with tests that verify that every session key has a TTL.