put<T> method
Stores object under key.
ttl semantics (identical across all providers):
null— the TTL policy attached to this provider resolves the duration from the key. If the policy returnsnullthe entry never expires.Duration.zero— treated as "no expiry" (equivalent to the policy returningnull). Do not passDuration.zeroexpecting immediate eviction.- Any positive Duration — the entry expires after that duration.
Both providers (memory and Redis) honor these semantics identically and
store a structural deep copy of object, so caller mutations after
put cannot corrupt the cached value.
Implementation
@override
FutureOr<void> put<T>(String key, T object, {Duration? ttl}) =>
store[key] = object;