HTTP cache invalidation: sub-resource collections need an extension point
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 68/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- laravel, php, symfony
調査の方向性
まず既存の PurgeHttpCacheListener の実装と Serializer\TagCollectorInterface を読み、次に src/HttpCache/ 領域と Symfony および Laravel の wiring を調査します。新しい provider interface が利用可能になり、optional provider が集約されて両方の listener から参照され、yield されたタグが追加され、この拡張ポイントがドキュメント化されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
PurgeHttpCacheListener (Symfony Doctrine and Laravel Eloquent) cannot invalidate sub-resource collection operations such as /parents/{parentId}/children. Resolving the IRI requires parent uriVariables that the listener does not have when it sees the modified entity, so those collection tags are silently skipped.
Pragmatic solution
Expose a public extension point — symmetric to Serializer\TagCollectorInterface on the response side — that the listener consults to collect extra tags for a given entity:
namespace ApiPlatform\HttpCache;
interface PurgeTagProviderInterface
{
/**
* @return iterable<string> additional cache tags to invalidate for $entity
*/
public function getTagsForResource(object $entity): iterable;
}
Wiring:
- Tagged service (Symfony) / iterator binding (Laravel), aggregated and injected into
PurgeHttpCacheListener. - The listener appends whatever the providers yield to its existing tag set.
- Default ships with no provider — users opt in.
This keeps identifier-finding out of the framework (the user knows how their child invalidates their parents) and lets each project plug exactly the strategy that fits its routing (parent uri_variables, surrogate-key prefixes, class-based tags, etc.).
Scope
- Add the interface in
src/HttpCache/. - Inject
iterable<PurgeTagProviderInterface>(optional, default empty) into both Symfony and LaravelPurgeHttpCacheListener. - Document the seam alongside
TagCollectorInterface.
- 主要言語
- PHP
- スター
- 2.6k
- フォーク
- 982
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 59
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
api-platform/core のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
api-platform/core#8573 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
api-platform/core#8571 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
api-platform/core#8564 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
api-platform/core#8495 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
api-platform/core#8471 ·
api-platform/core の issue をすべて見る
似ている issue
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/safe-publish#594 ·
-
HttpClient
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
symfony/symfony-docs#23092 ·
-
sync-en
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
sync-en
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
Перевод устарел
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100