diff --git a/lib/src/redis_service.dart b/lib/src/redis_service.dart index 80517f80..878e5282 100644 --- a/lib/src/redis_service.dart +++ b/lib/src/redis_service.dart @@ -29,6 +29,22 @@ class RedisService extends Service> { } } + @override + Future> create(Map data, + [Map params]) async { + String id; + if (data['id'] != null) + id = data['id'] as String; + else { + var keyVar = await respCommands.client + .writeArrayOfBulk(['INCR', _applyPrefix('angel_redis:id')]); + throw keyVar; + } + + await respCommands.set(_applyPrefix(id), json.encode(data)); + return data; + } + @override Future> update(String id, Map data, [Map params]) async {