platform/packages/redis/example/main.dart
Tobe O ae8f7a77d2 Add 'packages/redis/' from commit '929568c8660ecb4e6ddf1b6b616ab5591cb95419'
git-subtree-dir: packages/redis
git-subtree-mainline: 26afe42cb7
git-subtree-split: 929568c866
2020-02-15 18:29:13 -05:00

22 lines
595 B
Dart

import 'package:angel_redis/angel_redis.dart';
import 'package:resp_client/resp_client.dart';
import 'package:resp_client/resp_commands.dart';
main() async {
var connection = await connectSocket('localhost');
var client = new RespClient(connection);
var service = new RedisService(new RespCommands(client), prefix: 'example');
// Create an object
await service.create({'id': 'a', 'hello': 'world'});
// Read it...
var read = await service.read('a');
print(read['hello']);
// Delete it.
await service.remove('a');
// Close the connection.
await connection.close();
}