<PackageReference Include="Polly" Version="5.8.0" />

ResultTtl<TResult>

public class ResultTtl<TResult> : ITtlStrategy<TResult>
Defines a ttl strategy which can calculate a duration to cache items dynamically based on the execution context and result of the execution.
public ResultTtl(Func<TResult, Ttl> ttlFunc)

Constructs a new instance of the ResultTtl<T> ttl strategy, with a func calculating Ttl based on the TResult value to cache.

public ResultTtl(Func<Context, TResult, Ttl> ttlFunc)

Constructs a new instance of the ResultTtl<T> ttl strategy, with a func calculating Ttl based on the execution Context and TResult value to cache.

public Ttl GetTtl(Context context, TResult result)

Gets a TTL for the cacheable item.