Skip to content

1.20.0

Choose a tag to compare

@koriym koriym released this 11 Nov 02:22
· 207 commits to 1.x since this release

Added

  • #[DependsOn(uri: ...)] tags a stored resource with the URI it names, expanded from the onGet() arguments when on onGet() or from the public properties of each instance in the body when on a row class, so invalidating that URI also invalidates the resource and every page that embeds it. Tag array rows with UriTagInterface::fromAssoc(); a declaration that cannot expand fails the GET with BEAR\QueryRepository\Exception\DependsOnNotExpandable.
  • The log sink passes each flushed session to every LogWriterInterface an application adds with MultiBinder::newInstance($this, LogWriterInterface::class)->addBinding(). Bind the added class as well (ray-di/Ray.Compiler#148).
  • The context schemas mark the values that differ on every run (durationMs of cache_hit, cache_miss and invalidate; the etag of save_etag) with "x-volatile": true, so stree --snapshot --schema-dir=docs/schemas/context renders them as [volatile] (semantic-logger 0.11.1 or later).

Changed

  • Requires ray/di 2.23 or later.
  • Behaviour change: a #[Cacheable] body that does not serialize fails the request in every environment (cache_error{operation: write}), unless the response sets Cache-Control: no-store or private itself and so is not stored; a write whose refresh builds such a body fails after the write has run, and a #[CacheableResponse] page under the deprecated MobileEtagModule fails the same way. Request each #[Cacheable] resource once in development before deploying.
  • Behaviour change: a #[Cacheable] response without a lifetime, and a class-level #[CacheableResponse] response, carry Cache-Control: max-age=0 instead of max-age=31536000 unless they declare a max-age or no-store; a CDN still follows s-maxage. Declare a lifetime for data that changes without a write.
  • Behaviour change: a #[Purge]/#[Refresh] whose URI template leaves out a required onGet() parameter now throws TemplateLacksRequiredParameter before the write runs. Add the parameter, or its snake_case name, to the template.
  • Behaviour change: a list given to an exploded query variable ({?id*}, ?id={ids*}) of a #[Purge]/#[Refresh] invalidates one URI per element, and an empty list invalidates nothing. To keep the old URI, drop the * from ?id={ids*}, and give {?id*} the last element instead of the list.
  • Deploy with a new CacheVersionModule version (or clear your pools) and a rebuilt injector. A browser that holds a response sent with max-age=31536000 keeps using it until it expires.

Removed

  • BodySerializationErrorHandlerInterface, ThrowSerializationError, SkipSerializationError and Exception\BodySerializationNotAllowedException, added in 1.19.0. Remove a binding of the interface, and catch the exception serialize() throws instead.
  • The put_skipped reason unserializable and its class field.

Fixed

  • A #[Cacheable(type: 'view')] entry or a partial ETag whose body does not serialize no longer runs the pre-write cleanup and its CDN purge on every request (#264).
  • A dependency declared while a #[CacheableResponse] or #[DonutCache] page renders also invalidates the stored template, so its purge rebuilds the page.
  • A write whose query spells an onGet() parameter in snake_case (user_id for $userId) refreshes the cache instead of throwing UnmatchedQuery or skipping the refresh (#275).
  • StorageMemcachedEtagModule keeps ETags in the Memcached servers it is given and no longer changes the servers of StorageMemcachedModule. Check that those servers are reachable before deploying; ETags, and depending on install order cached resources, start empty there.
  • A Stringable query value, such as a ULID object, is part of the cache key and URI tag, so different values no longer share one entry and a #[Purge]/#[Refresh] written with the string reaches it.
  • A #[Purge]/#[Refresh] on a write of a resource that is not #[Cacheable], called directly on an object taken from the injector, builds its URIs from the body and arguments instead of throwing a TypeError.
  • With an application's own UriTagInterface, a #[CacheableResponse] or #[DonutCache] page now carries its own URI tag and its holes' tags in that format, the one a purge sends; they were in the default format, so a purge could miss the page.