APPNETOS is under active development This website and its documentation are being prepared for public launch. Content and features may change.
Select Theme
Loading

Cached

Request-scoped autowire property-value caching.

Purpose & processing

Caches a value resolved by another supported property annotation. This is NOT the document Redis cache marker.

Parameters

Parameter Type Default Behavior
ttl int 60 Expiration time in seconds for cached values.
scope string 'request' Requested cache scope.
tags array [] Associated cache tags.

Example

#[CallObject(MyService::class, 'getValue')]
#[Cached(ttl: 60, scope: 'request')]
protected mixed $value = null;

Behavior and considerations

  • Only request scope is implemented by the current Autowire resolver, using an in-memory static cache.
  • Session and global scopes are declared but currently fall back to uncached resolution.
  • Tags do not currently provide tag-based invalidation in this resolver.
  • Used alone, without a supported value annotation, Cached raises an AnnotationException.

Source

shared/src/Core/Annotation/Cached.php

Next Steps

Previous

Shutdown

Explore Shutdown

Next

NoReturn

Explore NoReturn