SemanticCache.check() unconditionally refreshes TTL on hit (sliding-window with no opt-out)
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python, redis
- Lĩnh vực
- backend-api-design, databases
Hướng nghiên cứu
Bắt đầu trong redisvl/extensions/cache/llm/semantic.py tại SemanticCache.check(), quanh dòng 432, sau đó đọc constructor SemanticCache xung quanh và đường dẫn làm mới TTL hiện tại. Xác minh rằng cờ constructor được đề xuất và override theo mỗi lần gọi vẫn giữ nguyên hành vi mặc định, đồng thời cho phép chỉ đọc khi bị tắt; hoàn thành khi cả hai tùy chọn đều được hỗ trợ mà không thay đổi các caller hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Current behavior
SemanticCache.check (redisvl/extensions/cache/llm/semantic.py:432) refreshes the TTL of every matched entry on every hit:
# Refresh TTL on all found keys
for key in redis_keys:
self.expire(key)
This is a sliding-window TTL: a popular entry effectively lives as long as it keeps getting hit. There is no constructor flag, per-call argument, or per-entry attribute to disable this.
Why this is a problem
Sliding window is the wrong default in any domain where the popularity of an entry correlates with the cost of it being stale:
- a procedure superseded by a regulatory bulletin that the cache has not yet invalidated
- a balance-patch-affected gameplay answer in a live-ops surface
- a pricing or eligibility answer that changed at midnight
In these domains the most-asked question is the most likely to be cached and the most likely to fan out a stale answer. The standard mitigation today — store an absolute expires_at numeric and filter on it at read time — works but requires every customer to discover the pattern independently.
Proposed API
SemanticCache(
name="cache",
redis_url=...,
refresh_ttl_on_hit=True, # current behavior, default unchanged
)
cache.check(
prompt=...,
refresh_ttl=None, # per-call override
)
refresh_ttl_on_hit=False would make check() a pure read. Customers wanting absolute expiry would set this to False, store a numeric expires_at filterable field, and filter on it.
Backwards compatibility
Default remains True. Existing behavior unchanged. Opt-in behavioral change for customers who need it.
Notes
Surfaced while writing a scoped semantic caching architecture spec; came up repeatedly when stress-testing the design against regulated and fast-mutating domains where sliding-window TTL is actively hostile.
- Ngôn ngữ chính
- Python
- Star
- 432
- Fork
- 111
- Merge trung bình
- 5 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của redis/redis-vl-python
-
exists() depends on exact FT.INFO error wording; an unrecognised "missing index" message makes create() never create the index (regression from #672)Có thể đã có người làm @nandanadileep đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
redis/redis-vl-python#773 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Vector field with index_missing=True cannot be createdCó thể đã có người làm @RaphaelFakhri đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
redis/redis-vl-python#770 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Add Python 3.15 supportCó thể đã có người làm @vishal-bala đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
redis/redis-vl-python#757 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 4 ngày
-
SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)Có thể đã có người làm @Hashim1999164 đã nhận 8 ngày trước. Đang mởbug good first issue index
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
redis/redis-vl-python#601 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
redis/redis-vl-python#300 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của redis/redis-vl-python
Issue tương tự
-
area/config comp/tools P2 platform/telegram type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NousResearch/hermes-agent#145412 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[oblt-aw][autodoc] Update docs for security org scaffolding and Docs AI menu permission changesCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Community project: hosted MOSS-Image studio with a visual JSON layout builder (no ComfyUI needed)Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 65/100
OpenMOSS/MOSS-Image#27 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
deepspeedai/DeepSpeed#8925 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
external integration integration-submission
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
langchain-ai/docs#7077 ·
Maintainer thường phản hồi trong vòng 1 ngày