From 7b698db01c3bfdb1a83d0b3a7ecb18e49e447419 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 21 Oct 2018 14:15:38 -0400 Subject: [PATCH] Readme advisory + changelog --- CHANGELOG.md | 2 ++ README.md | 32 +++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..b23475f1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +# 1.0.0 +* First version. \ No newline at end of file diff --git a/README.md b/README.md index 4f27ad53..0f66a418 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,34 @@ Without a prefix, there's a chance that different collections can overwrite one become a bottleneck. * `remove` uses `MULTI`+`EXEC` in a transaction. * Prefer using `update`, rather than `modify`. The former only performs one query, though it does overwrite the current -contents for a given key. \ No newline at end of file +contents for a given key. +* When calling `create`, it's possible that you may already have an `id` in mind to insert into the store. For example, +when caching another database, you'll preserve the ID or primary key of an item. `angel_redis` heeds this. If no +`id` is present, then an ID will be created via an `INCR` call. + +## Example + +```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(); +} +``` \ No newline at end of file