You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 24, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+31-43Lines changed: 31 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,34 @@ for updates, or [StackOverflow](http://stackoverflow.com/questions/ask) or the [
3
3
4
4
# C#/.NET Client for Redis
5
5
6
+
[ServiceStack's C# Redis Client](https://github.com/ServiceStack/ServiceStack.Redis) is a simple, high-performance and feature-rich C# Client for Redis with native support and [high-level abstractions](https://github.com/ServiceStack/ServiceStack.Redis/wiki/DesigningNoSqlDatabase) for serializing POCOs and Complex Types.
7
+
8
+
There are a number of different APIs available with the `RedisClient` implementing the following interfaces:
9
+
10
+
*[ICacheClient](http://docs.servicestack.net/caching) - If you are using Redis solely as a cache, you should bind to the ServiceStack's common interface as there already are In-Memory an Memcached implementations available in ServiceStack, allowing you to easily switch providers
11
+
*[IRedisNativeClient](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Redis/IRedisNativeClient.cs) - For those wanting a low-level raw byte access (where you can control your own serialization/deserialization) that map 1:1 with Redis operations of the same name.
12
+
13
+
For most cases if you require access to Redis specific functionality you would want to bind to the interface below:
14
+
15
+
*[IRedisClient](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Redis/IRedisClient.cs) - Provides a friendlier, more descriptive API that lets you store values as strings (UTF8 encoding).
16
+
*[IRedisTypedClient](https://github.com/ServiceStack/ServiceStack/tree/master/src/ServiceStack.Interfaces/Redis/Generic) - created with `IRedisClient.As<T>()` - it returns a 'strongly-typed client' that provides a typed-interface for all redis value operations that works against any C#/.NET POCO type.
17
+
18
+
The interfaces works cleanly with any IOC and allows your app logic to bind to implementation-free interfaces which can easily be mocked and substituted.
19
+
20
+
An overview of class hierarchy for the C# Redis clients looks like:
With each client providing different layers of abstraction:
25
+
26
+
* The RedisNativeClient exposes raw `byte[]` apis and does no marshalling and passes all values directly to redis.
27
+
* The RedisClient assumes `string` values and simply converts strings to UTF8 bytes before sending to Redis
28
+
* The RedisTypedClient provides a generic interface allowing you to add POCO values. The POCO types are serialized using [.NETs fastest JSON Serializer](http://www.servicestack.net/mythz_blog/?p=344) which is then converted to UTF8 bytes and sent to Redis.
More examples can be found in the [Redis Eval Lua tests](https://github.com/ServiceStack/ServiceStack.Redis/blob/master/tests/ServiceStack.Redis.Tests/RedisClientEvalTests.cs
734
762
)
735
763
736
-
## Overview
737
-
738
-
*The Redis client is an independent project and can be used with or without the ServiceStack webservices framework.*
739
-
740
-
[Redis](http://code.google.com/p/redis/) is one of the fastest and most feature-rich key-value stores to come from the [NoSQL](http://en.wikipedia.org/wiki/NoSQL) movement.
741
-
It is similar to memcached but the dataset is not volatile, and values can either be strings lists, sets, sorted sets or hashes.
742
-
743
-
[ServiceStack's C# Redis Client](https://github.com/ServiceStack/ServiceStack.Redis) is an Open Source C# Redis client based on [Miguel de Icaza](http://twitter.com/migueldeicaza) previous efforts with [redis-sharp](http://github.com/migueldeicaza/redis-sharp).
744
-
745
-
There are a number of different APIs available which are all a friendly drop-in with your local IOC:
746
-
The `ServiceStack.Redis.RedisClient` class below implements the following interfaces:
747
-
748
-
*[ICacheClient](https://github.com/ServiceStack/ServiceStack/wiki/Caching) - If you are using Redis solely as a cache, you should bind to the [ServiceStack's common interface](https://github.com/ServiceStack/ServiceStack.Redis/wiki/Caching) as there already are In-Memory an Memcached implementations available in ServiceStack, allowing you to easily switch providers in-future.
749
-
*[IRedisNativeClient](https://github.com/ServiceStack/ServiceStack.Redis/wiki/IRedisNativeClient) - For those wanting a low-level raw byte access (where you can control your own serialization/deserialization) that map 1:1 with Redis operations of the same name.
750
-
751
-
For most cases if you require access to Redis specific functionality you would want to bind to the interface below:
752
-
753
-
*[IRedisClient](https://github.com/ServiceStack/ServiceStack.Redis/wiki/IRedisClient) - Provides a friendlier, more descriptive API that lets you store values as strings (UTF8 encoding).
754
-
*[IRedisTypedClient](https://github.com/ServiceStack/ServiceStack.Redis/wiki/IRedisTypedClient) - created with `IRedisClient.As<T>()` - it returns a 'strongly-typed client' that provides a typed-interface for all redis value operations that works against any C#/.NET POCO type.
755
-
756
-
The class hierarchy for the C# Redis clients effectively look like:
Each client provides a different layer of abstraction:
761
-
762
-
* The RedisNativeClient exposes raw **byte[]** apis and does no marshalling and passes all values directly to redis.
763
-
* The RedisClient assumes **string** values and simply converts strings to UTF8 bytes before sending to Redis
764
-
* The RedisTypedClient provides a generic interface allowing you to add POCO values. The POCO types are serialized using [.NETs fastest JSON Serializer](http://www.servicestack.net/mythz_blog/?p=344) which is then converted to UTF8 bytes and sent to Redis.
For multi-threaded applications you can choose from our different client connection managers:
764
+
## Copying
771
765
772
-
* BasicRedisClientManager - a load-balance (master-write and read-slaves) client manager that returns a new [IRedisClient](https://github.com/ServiceStack/ServiceStack.Redis/wiki/IRedisClient) connection with the defaults specified (faster when accessing a redis-server instance on the same host).
773
-
* PooledRedisClientManager - a load-balanced (master-write and read-slaves) client manager that utilizes a pool of redis client connections (faster when accessing a redis-server instance over the network).
766
+
Since September 2013, ServiceStack source code is available under GNU Affero General Public License/FOSS License Exception, see license.txt in the source. Alternative commercial licensing is also available, see https://servicestack.net/pricing for details.
774
767
775
768
### [Docs and Downloads for older v3 BSD releases](https://github.com/ServiceStackV3/ServiceStackV3)
776
769
777
-
## Copying
778
-
779
-
Since September 2013, ServiceStack source code is available under GNU Affero General Public License/FOSS License Exception, see license.txt in the source.
780
-
Alternative commercial licensing is also available, see https://servicestack.net/pricing for details.
781
-
782
770
## Contributing
783
771
784
-
Commits should be made to the **v3-fixes** branch so they can be merged into both **v3** and **master** (v4) release branches.
785
772
Contributors need to approve the [Contributor License Agreement](https://docs.google.com/forms/d/16Op0fmKaqYtxGL4sg7w_g-cXXyCoWjzppgkuqzOeKyk/viewform) before any code will be reviewed, see the [Contributing wiki](https://github.com/ServiceStack/ServiceStack/wiki/Contributing) for more details.
786
773
787
774
### Redis Server builds for Windows
788
775
776
+
*[Redis on Windows](https://github.com/ServiceStack/redis-windows)
789
777
*[MS Open Tech - Redis on Windows](https://github.com/MSOpenTech/Redis)
790
778
*[Downloads for Cygwin 32bit Redis Server Windows builds](http://code.google.com/p/servicestack/wiki/RedisWindowsDownload).
791
779
*[Project that lets you run Redis as a Windows Service](https://github.com/rgl/redis)
0 commit comments