Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

usage examples for KeyValueStore in README

  • Loading branch information...
commit fdeedd87ee680f6c097b8a9793b38c4d12792e5a 1 parent 7695fd3
@nathanwdavis nathanwdavis authored
Showing with 28 additions and 1 deletion.
  1. +28 −1 README.md
View
29 README.md
@@ -36,8 +36,35 @@ Do the same except in the `httpModules` element in the `system.web` element.
### Bucketed Key-Value store (`AngiesList.Redis.KeyValueStore`)
-...coming soon...
+Example usage:
+```csharp
+var tags = KeyValueStore.Bucket("tags");
+tags.Set("redis", "The swiss army knife data structure server");
+
+var description = tags.GetStringSync("redis");
+```
+
+You can optionally set an expiration (in seconds) when you use `Set`:
+
+```csharp
+KeyValueStore.Bucket("contentCache").Set("about_us", "We're awesome!", 600);
+```
+
+There are more getter methods:
+
+* For binary data (GetRawSync() returns byte[])
+* For whatever type T you want. GetSync<T> returns T and handles the (de)serialization from and to T for you.
+* For callback based async operations, there are asyncronous version of all the Get_ methods. Example:
+
+```csharp
+bigNumbers.Get<Int64>("a_trillion", (num, exc) => {
+ if (exc == null) {
+ //do something with num
+ }
+});
+```
+
<br />
### TODO:
Please sign in to comment.
Something went wrong with that request. Please try again.