Skip to content

Extension points

phil/http-cache-tags-bundle

What an application implements, tags, configures or relies on.

Ports

CacheTagResolver

Phil\HttpCacheTagsBundle\Application\CacheTagResolver — the tags of the responses that show an entity. A service implementing it is tagged phil_http_cache_tags.resolver by autoconfiguration. See Purging.

MethodContract
tagsFor(object $entity): iterable<string>The tags to purge when the entity changes, none for an entity it does not know; cheap, since every entity a flush changes is passed to every resolver

CacheTagPurger

Phil\HttpCacheTagsBundle\Application\CacheTagPurger — the cache in front. VarnishPurger or CloudflarePurger, by purger; a service of the application's own, aliased to the port, replaces the configured one — a Fastly purger, a CDN of its own.

MethodContract
purge(list<string> $tags): voidPurges every response with one of the tags; tries every target even when one fails, then throws one PurgeFailed naming each failure

Tagging

FromHow
A controller#[CacheTag('page:{id}', 'menu')], {name} a request attribute
A templatecache_tag()
CodeResponseTags::add()

See Tagging.

Configuration

OptionWhat it extends
headerThe header the tags are written in: xkey, cache-tag or surrogate-key
purgerWhich cache is purged: none, varnish or cloudflare
varnish, cloudflareWhere and how
invalidate_entitiesWhether every entity a Doctrine flush changes is passed to the resolvers

Services

ServiceHow an application relies on it
Invalidatorinvalidate() and invalidateEntity(), for tags and objects no flush carries; purged once at the end of the request, command or message
ResponseTagsThe tags of the current response; public, reset between requests

Purge failures are logged on the http_cache channel: a Monolog handler of the application's on that channel sends them where it wants.