jsonClear method
JSON.CLEAR key path
Clears the arrays or objects at path.
Numeric values are set to 0.
key The key to modify.
path The JSON path. Defaults to root ($).
Returns the number of containers cleared (integer).
Implementation
Future<int> jsonClear({
required String key,
String path = r'$',
}) async {
final result = await execute(<String>['JSON.CLEAR', key, path]);
// Valkey/Redis returns the count as an integer
if (result is int) return result;
return int.tryParse(result.toString()) ?? 0;
}