Class McpCachePolicy
java.lang.Object
com.soklet.McpCachePolicy
Immutable MCP application-cache policy.
The policy fixes both the cache scope and the default time to live for its owning operation. A result may override only the time to live where the operation's result type explicitly permits it.
The cache vocabulary is revision-sensitive rather than a permanent closed enum contract. Code switching on cache scope should retain a forward-compatible default for a future protocol revision.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic @NonNull McpCachePolicyfromPrivateTimeToLive(@NonNull Duration timeToLive) Creates a private policy with the supplied default time to live.static @NonNull McpCachePolicyfromPublicTimeToLive(@NonNull Duration timeToLive) Creates a public policy with the supplied default time to live.getScope()inthashCode()static @NonNull McpCachePolicyReturns the shared private policy with a zero time to live.
-
Method Details
-
privateNoCacheInstance
Returns the shared private policy with a zero time to live.- Returns:
- private zero-TTL policy
-
fromPrivateTimeToLive
Creates a private policy with the supplied default time to live.- Parameters:
timeToLive- nonnegative whole-millisecond default duration- Returns:
- private cache policy
-
fromPublicTimeToLive
Creates a public policy with the supplied default time to live.Callers must use public scope only when results do not vary by principal, tenant, authorization partition, or other private identity.
- Parameters:
timeToLive- nonnegative whole-millisecond default duration- Returns:
- public cache policy
-
getTimeToLive
- Returns:
- nonnegative whole-millisecond default time to live
-
getScope
- Returns:
- fixed cache scope
-
equals
-
hashCode
-