CacheHeadersMiddleware class final
Laravel's cache.headers middleware (SetCacheHeaders):
router.get('/catalog', catalog).middleware(const [
'cache.headers:public;max_age=3600;etag',
]);
On successful GET/HEAD responses with a body it sets Cache-Control
from the options (public, private, max_age, s_maxage,
must_revalidate, no_cache, no_store, no_transform,
proxy_revalidate, immutable, stale_while_revalidate,
stale_if_error), ETag (etag: a hash of the body) and
Last-Modified (last_modified: a Unix timestamp or a date), and
answers 304 Not Modified when If-None-Match (or, without it,
If-Modified-Since) shows the client's copy is current. Headers are
written as Symfony writes them for Laravel: directives sorted, private
added when neither public, private nor s-maxage is given.
- Implemented types
Constructors
-
CacheHeadersMiddleware(Map<
String, String?> options) -
const
-
CacheHeadersMiddleware.fromParams(List<
String> params) -
cache.headers:public;max_age=3600;etag(the alias' parameter).factory
Properties
Methods
-
handle(
Request request, Next next) → Future< Response> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
parseOptions(
String options) → Map< String, String?> -
Laravel's
parseOptions:public;max_age=3600;etag.