Skip to content

Conversation

@jcfneto
Copy link

@jcfneto jcfneto commented Dec 6, 2025

  • Add REDIS_TTL environment variable (default: 0 = no expiration)
  • Apply TTL to all set operations in RedisKVStorage and RedisDocStatusStorage
  • TTL value is in seconds

Description

Add configurable TTL (Time-To-Live) support for Redis storage implementations. This allows users to set an expiration time for cached data in Redis, which is useful for managing memory usage and ensuring stale data is automatically removed.

This is particularly useful for organizations that have internal data retention policies requiring cached data to expire after a specific period. By configuring the TTL, users can ensure compliance with their company's data governance requirements while also managing Redis memory usage more effectively.

Changes Made

  • Add REDIS_TTL environment variable to configure key expiration time (default: 0 = no expiration)
  • Apply TTL to all set operations in RedisKVStorage.upsert() method
  • Apply TTL to all set operations in RedisDocStatusStorage.upsert() method
  • Apply TTL to cache migration operations in RedisKVStorage._migrate_legacy_cache_structure()
  • TTL value is specified in seconds (e.g., 86400 for 24 hours, 604800 for 7 days)

Checklist

  • Changes tested locally
  • Code reviewed
  • Documentation updated (if necessary)
  • Unit tests added (if applicable)

Additional Notes

Usage

Set the REDIS_TTL environment variable to enable key expiration:

# No expiration (default)
export REDIS_TTL=0

# 24 hours
export REDIS_TTL=86400

# 7 days
export REDIS_TTL=604800

When REDIS_TTL is set to 0 (default), keys will never expire, maintaining backward compatibility with existing behavior.

- Add REDIS_TTL environment variable (default: 0 = no expiration)
- Apply TTL to all set operations in RedisKVStorage and RedisDocStatusStorage
- TTL value is in seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant