Class CacheableResult<T extends CacheableResult<T>>
- Type Parameters:
T- The concrete subclass, for fluent-setter self-typing.
- Direct Known Subclasses:
ListPromptsResult,ListResourcesResult,ListResourceTemplatesResult,ListToolsResult,ReadResourceResult,ServerDiscoverResult
2026-07-28 result carriers
(tools/list, prompts/list, resources/list, resources/templates/list, and
resources/read).
Extends Result so every cacheable result also inherits the required resultType discriminator
and optional _meta, alongside two nullable, independent, top-level cache-hint properties that are
peers of each subclass's own payload properties:
ttlMs- Freshness duration in milliseconds (Cache-Control: max-agesemantics).0means immediately stale.cacheScope-McpCacheScope.PUBLICorMcpCacheScope.PRIVATE. An absent value is interpreted by consumers aspublic, but that interpretation is never materialized on the wire.
This base is a lossless wire carrier only: it performs no ttlMs validation and does not synthesize a
default cacheScope. Wire beans must be able to parse and round-trip arbitrary protocol payloads
(including a negative parsed ttlMs) independently of any server-side configuration policy. TTL
validation for values the server itself emits is owned by the 2026-07-28 adapter's cache
configuration, not by this bean.
The CRTP type parameter lets each concrete subclass's cache setters (and the inherited Result
setters) return its own concrete type for fluent chaining, without duplicating those accessors in every
subclass.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCache-hint authorization scope.getTtlMs()Cache freshness duration in milliseconds.setCacheScope(McpCacheScope value) Sets the cache-hint authorization scope.Sets the cache freshness duration in milliseconds.Methods inherited from class org.apache.juneau.bean.mcp.v20260728.Result
getMeta, getResultType, setMeta, setResultType
-
Constructor Details
-
CacheableResult
public CacheableResult()
-
-
Method Details
-
getTtlMs
Cache freshness duration in milliseconds.- Returns:
- The TTL, or
nullif not set.
-
setTtlMs
Sets the cache freshness duration in milliseconds.- Parameters:
value- The new value. Can benull to unset the property.0is a valid, meaningful value meaning immediately stale.- Returns:
- This object (for method chaining).
-
getCacheScope
Cache-hint authorization scope.- Returns:
- The scope, or
nullif not set.
-
setCacheScope
Sets the cache-hint authorization scope.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object (for method chaining).
-