From 1d902262c6bfd31c033c542f5dc8579a1fc473ff Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 21 Oct 2018 14:12:54 -0400 Subject: [PATCH] example --- example/main.dart | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/example/main.dart b/example/main.dart index 8b137891..c5614d23 100644 --- a/example/main.dart +++ b/example/main.dart @@ -1 +1,22 @@ +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(); +}