Skip to content

Conversation

@abrookins
Copy link
Collaborator

This PR adds support for LangCache supports item-specific TTLs. We also begin using quote() and unquote() to manage the variety of characters that can disrupt queries that use attributes.

Copilot AI review requested due to automatic review settings November 25, 2025 23:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for item-specific TTLs to the LangCache semantic cache implementation and replaces custom fullwidth character encoding with standard URL percent-encoding for attribute values. The changes enable per-entry TTL overrides and improve the handling of special characters in attribute values.

Key changes:

  • Added per-entry TTL support by converting seconds to milliseconds for the LangCache API
  • Replaced custom fullwidth character encoding with URL percent-encoding (quote/unquote) for attribute values
  • Updated unit and integration tests to verify TTL functionality and encoding behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
redisvl/extensions/cache/llm/langcache.py Implements TTL conversion to milliseconds, removes custom encoding functions, uses quote/unquote for attributes
tests/unit/test_langcache_semantic_cache.py Adds unit tests for per-entry TTL, updates attribute encoding test expectations, improves import error test
tests/integration/test_langcache_semantic_cache_integration.py Adds integration tests for TTL expiration behavior, updates encoding comments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 25, 2025 23:54
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Collaborator

@rbs333 rbs333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abrookins abrookins merged commit 708e7f5 into main Dec 2, 2025
40 checks passed
bsbodden added a commit to redis/redis-vl-java that referenced this pull request Dec 11, 2025
…port

Implements Python redis-vl PR #442 features for LangCache:

**URL Percent-Encoding:**
- Replace fullwidth Unicode character encoding with standard URL percent-encoding (RFC 3986)
- Use URLEncoder/URLDecoder for attribute value encoding/decoding
- Encodes problematic characters: comma (%2C), slash (%2F), backslash (%5C), question mark (%3F)
- Provides better compatibility and follows standard web encoding practices

**Per-Entry TTL Support:**
- Add overloaded store() method accepting TTL parameter in seconds
- Convert TTL from seconds to milliseconds for LangCache API (ttl_millis)
- Allows individual cache entries to expire independently of cache-wide TTL

**Testing:**
- Added comprehensive unit tests for URL encoding/decoding
- Added integration test for per-entry TTL (disabled due to API propagation delays)
- Updated existing encoding tests to expect URL percent-encoding
- All 31 LangCache tests passing (1 skipped)

Port of redis-vl-python PR #442: redis/redis-vl-python#442
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.

4 participants