put<T> method

  1. @override
Future<void> put<T>(
  1. String key,
  2. T object, {
  3. Duration? ttl,
})

Stores object under key.

If ttl is provided, the entry expires after that duration. Providers that support expiration (e.g. memory, Redis) honor this; providers that don't may ignore it. A null ttl means "never expire".

Implementation

@override
Future<void> put<T>(String key, T object, {Duration? ttl}) async {
  final effectiveTtl = ttl ?? _ttlPolicy.ttlFor(key);
  final command = buildSetCommand(key, jsonEncode(object), effectiveTtl);
  await Command(_connection).send_object(command);
}