SemanticCache.check() unconditionally refreshes TTL on hit (sliding-window with no opt-out)
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 70/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- python, redis
調査の方向性
redisvl/extensions/cache/llm/semantic.py の SemanticCache.check()(432 行目付近)から始め、続いて周辺の SemanticCache コンストラクターと現在の TTL 更新パスを確認してください。提案されたコンストラクターフラグと呼び出し単位のオーバーライドによってデフォルトの動作が維持され、無効化した場合に純粋な読み取りが可能になることを検証してください。既存の呼び出し元を変更せずに両方のオプションがサポートされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 432
- フォーク
- 111
- 平均マージ
- 4日 22時間
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
redis/redis-vl-python のほかの issue
-
exists() depends on exact FT.INFO error wording; an unrecognised "missing index" message makes create() never create the index (regression from #672)対応中かも @nandanadileep が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
redis/redis-vl-python#773 ·
メンテナーはふだん 2 日以内に返信
-
Vector field with index_missing=True cannot be created対応中かも @RaphaelFakhri が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
redis/redis-vl-python#770 ·
メンテナーはふだん 2 日以内に返信
-
Add Python 3.15 support対応中かも @vishal-bala が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
redis/redis-vl-python#757 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)対応中かも @Hashim1999164 が 7 日前に担当しました。 オープンbug good first issue index
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
redis/redis-vl-python#601 ·
メンテナーはふだん 2 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
redis/redis-vl-python#300 ·
メンテナーはふだん 2 日以内に返信
redis/redis-vl-python の issue をすべて見る
似ている issue
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog check対応中かも @ocelotl が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
open-telemetry/opentelemetry-python#5825 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cuga-project/cuga-agent#1020 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
microsoft/playwright#43640 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
stac-utils/stac-fastapi-elasticsearch-opensearch#965 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信