Redis was recently used in the project to store downloaded URLs, and the project used Servicestack to operate Redis, beginning with the latest version of Servicestack and later found Servicestack has been commercialized, and the non-commercial version can only operate 6,000 redis per hour, later replacing Servicestack with the V3 version.
A Redis hash set was used in the project, but the Servicestack package was inconvenient to use, so it encapsulated a DLL and used the Servicestack pool to dynamically create iredisclient instances. An abstract class has been created Redisoperatorbase encapsulates some basic methods. Relatively simple, I believe you see the code will be.
Code github:https://github.com/dazhuangtage/redisdemo/
The following is the simplest use:
First configure the File configuration node:
<configSections> <section name="Redistools"Type="Redistools.redisconfig, Redistools"/> </configSections> <redistools writeserverlist="127.0.0.1:6379"readserverlist="[Email protected]:6379"Maxwritepoolsize=" -"Maxreadpoolsize=" -"autostart="true"Localcachetime=" the"recordelog="false"/></configuration>
How to use:
/// <summary> ///The main entry point for the application. /// </summary> Static voidMain (string[] args) { varHashoperator =NewHashoperator (); Hashoperator.set ("Test","name","Big strong his brother"); Console.WriteLine (Hashoperator.get<string> ("Test","name")); Console.readkey (); }
If you want to extend a helper class, just inherit the redisoperatorbase.
Share a Redis helper class