set method
Future<RespType>
set(
- String key,
- Object value, {
- ExpireMode? expire,
- SetMode? mode,
- bool get = false,
Implementation
Future<RespType> set(String key, Object value, {ExpireMode? expire, SetMode? mode, bool get = false}) async {
final expireTime = expire?.time;
final expireTimestamp = expire?.timestamp;
return tier0.execute([
'SET',
key,
value,
if (expireTime != null) ...['PX', '${expireTime.inMilliseconds}'],
if (expireTimestamp != null) ...['PXAT', '${expireTimestamp.millisecondsSinceEpoch}'],
if (expire != null && expireTime == null && expireTimestamp == null) 'KEEPTTL',
if (mode == SetMode.onlyIfNotExists) 'NX',
if (mode == SetMode.onlyIfExists) 'XX',
if (get) 'GET',
]);
}