@@ -35,7 +35,7 @@ The object returned from `GetDatabase` is a cheap pass-thru object, and does not
object asyncState = ...
IDatabase db = redis.GetDatabase(databaseNumber, asyncState);
Once you have the `IDatabase`, it is simply a case of using the [redis API](http://redis.io/commands). Note that all methods have both synchronous and asynchronous implementaions. In line with Microsoft's naming guidance, the asynchronous methods all end `...Async(...)`, and are fully `await`-able etc.
Once you have the `IDatabase`, it is simply a case of using the [redis API](http://redis.io/commands). Note that all methods have both synchronous and asynchronous implementations. In line with Microsoft's naming guidance, the asynchronous methods all end `...Async(...)`, and are fully `await`-able etc.
The simplest operation would be to store and retrieve a value:
...
...
@@ -100,12 +100,12 @@ There are 3 primary usage mechanisms with StackExchange.Redis:
- Asynchronous - where the operation completes some time in the future, and a `Task` or `Task<T>` is returned immediately, which can later:
- be `.Wait()`ed (blocking the current thread until the response is available)
- have a continuation callback added ([`ContinueWith`](http://msdn.microsoft.com/en-us/library/system.threading.tasks.task.continuewith(v=vs.110).aspx) in the TPL)
- be *awaited* (which is a language-level feature that simplfies the latter, while also continuing immediately if the reply is already known)
- be *awaited* (which is a language-level feature that simplifies the latter, while also continuing immediately if the reply is already known)
- Fire-and-Forget - where you really aren't interested in the reply, and are happy to continue irrespective of the response
The synchronous usage is already shown in the examples above. This is the simplest usage, and does not involve the [TPL][1].
For asynchronous uage, the key difference is the `Async` suffix on methods, and (typically) the use of the `await` language feature. For example:
For asynchronous usage, the key difference is the `Async` suffix on methods, and (typically) the use of the `await` language feature. For example:
@@ -93,4 +93,4 @@ The response uses the `RedisResult` type (this is unique to scripting; usually t
Conclusion
---
The types used in the API are very deliberately chosen to distinguish redis *keys* from *values*. However, in virtually all cases you will not need to directly refer to the unerlying types involved, as conversion operations are provided.
The types used in the API are very deliberately chosen to distinguish redis *keys* from *values*. However, in virtually all cases you will not need to directly refer to the underlying types involved, as conversion operations are provided.
@@ -76,7 +76,7 @@ For this reason, the only redis features that StackExchange.Redis does not offer
This achieves the same intent without requiring blocking operations. Notes:
-the *data* is not sent via pub/sub; the pub/sub API is only used to notify workers to check for more work
-if there are no workers, the new items remain buffered in the lsit; work does not fall on the floor
-if there are no workers, the new items remain buffered in the list; work does not fall on the floor
-only one worker can pop a single value; when there are more consumers than producers, some consumers will be notified and then find there is nothing to do
-when you restart a worker, you should *assume* there is work so that you process any backlog
-but other than that, the semantic is identical to blocking pops