setString method

Future<void> setString(
  1. String key,
  2. String value, [
  3. DistributedCacheEntryOptions? options
])

Sets a string value in the cache with the given key.

The value is encoded as UTF-8 bytes before storage. options can be provided to configure expiration.

Implementation

Future<void> setString(
  String key,
  String value, [
  DistributedCacheEntryOptions? options,
]) {
  final bytes = Uint8List.fromList(utf8.encode(value));
  return set(key, bytes, options);
}