Add optional TTL configuration for Redis object store#1157
Add optional TTL configuration for Redis object store#1157rapids-bot[bot] merged 2 commits intoNVIDIA:developfrom
Conversation
Signed-off-by: Patrick Chin <8509935+thepatrickchin@users.noreply.github.com>
WalkthroughAdds optional TTL support: Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RedisObjectStore
participant Redis
Client->>RedisObjectStore: put_object(key, value) / upsert_object(...)
Note right of RedisObjectStore: _ttl present? (int | None)
alt _ttl is set
RedisObjectStore->>Redis: SET key value EX _ttl NX?/-- (depends on op)
Redis-->>RedisObjectStore: OK / Error
else _ttl is None
RedisObjectStore->>Redis: SET key value NX?/-- (no EX)
Redis-->>RedisObjectStore: OK / Error
end
RedisObjectStore-->>Client: Success / Error
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py (1)
29-34: Consider updating class docstring to mention TTL support.For consistency with the updated
RedisObjectStoreClientConfigdocstring, consider mentioning the optional TTL capability in the class documentation.Example update:
class RedisObjectStore(ObjectStore): """ - Implementation of ObjectStore that stores objects in Redis. + Implementation of ObjectStore that stores objects in Redis with optional TTL. Each object is stored as a single binary value at key "nat/object_store/{bucket_name}/{object_key}". + When TTL is configured, keys will automatically expire after the specified duration in seconds. """
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py(1 hunks)packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py(4 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py
🧠 Learnings (1)
📚 Learning: 2025-08-23T02:55:39.346Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 649
File: src/nat/cli/commands/object_store/object_store.py:32-42
Timestamp: 2025-08-23T02:55:39.346Z
Learning: In the NAT object store plugin architecture, config classes like S3ObjectStoreClientConfig, MySQLObjectStoreClientConfig, and RedisObjectStoreClientConfig are defined in the object_store.py files (e.g., nat.plugins.s3.object_store), while the implementation classes are in separate files (e.g., nat.plugins.s3.s3_object_store). The registration functions are also in the object_store.py files.
Applied to files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
🔇 Additional comments (5)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py (1)
26-27: LGTM: Clear docstring update.The docstring accurately reflects the new optional TTL capability.
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py (4)
36-45: LGTM: Constructor signature properly extended.The
ttlparameter is correctly added to the constructor signature with appropriate type hints and default value.
54-54: LGTM: TTL properly stored as instance attribute.
101-101: LGTM: TTL correctly applied in put_object.The TTL is properly passed to Redis SET via the
exparameter. Whenttl=None, no expiration is set, preserving existing behavior.
113-113: LGTM: TTL correctly applied in upsert_object.Consistent TTL application in the upsert path.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py (1)
27-28: End the summary line with a period.The docstring summary needs to end with a period to satisfy the Google-style docstring requirement. As per coding guidelines.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py(2 hunks)packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py(4 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
🧠 Learnings (1)
📚 Learning: 2025-08-23T02:55:39.346Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 649
File: src/nat/cli/commands/object_store/object_store.py:32-42
Timestamp: 2025-08-23T02:55:39.346Z
Learning: In the NAT object store plugin architecture, config classes like S3ObjectStoreClientConfig, MySQLObjectStoreClientConfig, and RedisObjectStoreClientConfig are defined in the object_store.py files (e.g., nat.plugins.s3.object_store), while the implementation classes are in separate files (e.g., nat.plugins.s3.s3_object_store). The registration functions are also in the object_store.py files.
Applied to files:
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
🪛 Ruff (0.14.3)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
41-41: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: CI Pipeline / Check
Also mention optional TTL capability in the class documentation. Signed-off-by: Patrick Chin <8509935+thepatrickchin@users.noreply.github.com>
10243da to
04d0720
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py (2)
27-28: Consider enhancing the docstring with TTL behavior details.The updated docstring accurately mentions TTL support. For improved clarity, consider elaborating on the behavior: "When TTL is provided, stored objects expire after the specified seconds; omitting TTL preserves objects indefinitely."
37-42: Excellent validation logic!The validator correctly enforces that TTL must be a positive integer when provided, preventing edge cases like 0 (immediate expiration) or negative values. This addresses the past review comment.
Optional style refinement: Ruff flagged TRY003, suggesting error messages could be defined as class constants. However, for configuration validation, inline messages are often clearer. This is purely a style preference.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py(2 hunks)packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py(4 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.pypackages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
🪛 Ruff (0.14.3)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py
41-41: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (6)
packages/nvidia_nat_redis/src/nat/plugins/redis/object_store.py (2)
17-17: LGTM!The
field_validatorimport is correctly placed and used appropriately for the TTL validation.
35-35: LGTM!The TTL field is well-defined with appropriate type hints, default value, and clear description. The
Nonedefault correctly preserves existing behavior (no expiration).packages/nvidia_nat_redis/src/nat/plugins/redis/redis_object_store.py (4)
31-35: LGTM!The docstring accurately describes the TTL functionality. The explanation clearly states that keys expire automatically when TTL is configured, while the existing documentation implies persistence when TTL is not set.
37-55: LGTM!The constructor signature correctly accepts and stores the TTL parameter with appropriate type hints. The separation of concerns is good—validation happens at the config level, while this class focuses on storage logic.
102-102: LGTM!The
put_objectmethod correctly applies TTL using theexparameter. Whenself._ttlisNone, Redis will not set an expiration (preserving existing behavior). Whenself._ttlis a positive integer, the key expires automatically after the specified seconds. The combination ofnx=Trueandex=self._ttlproperly implements conditional creation with optional TTL.
114-114: LGTM!The
upsert_objectmethod correctly applies TTL using theexparameter. The implementation properly overwrites existing keys (nonxflag) while applying the TTL. Note that upserting resets the expiration timer on existing keys, which is the expected behavior for upsert operations.
|
/merge |
This PR adds an optional TTL configuration (in seconds) for Redis object stores. Omitting `ttl` results in no expiration as before.
```
object_stores:
my_object_store:
_type: redis
host: localhost
port: 6379
db: 0
bucket_name: my-bucket
ttl: 3600
```
## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/NeMo-Agent-Toolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
- Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.
## Summary by CodeRabbit
* **New Features**
* Redis object store supports optional Time To Live (TTL) for objects, enabling automatic expiration after a specified number of seconds.
* **Behavior Change**
* When TTL is configured, newly stored and upserted objects will expire automatically after the TTL; default remains no expiration.
* **Chores**
* TTL values are validated to ensure they are positive when provided.
Authors:
- Patrick Chin (https://github.com/thepatrickchin)
Approvers:
- Will Killian (https://github.com/willkill07)
URL: NVIDIA#1157
Signed-off-by: Sangharsh Aglave <aglave@synopsys.com>
Description
This PR adds an optional TTL configuration (in seconds) for Redis object stores. Omitting
ttlresults in no expiration as before.By Submitting this PR I confirm:
Summary by CodeRabbit
New Features
Behavior Change
Chores