Redis Simple Read and write
Record key value.
First of all to refer to Redes, or code to speak it. Trouble.
Link Way//reference public static Pooledredisclientmanager poolreds;//This corresponding Redis library static int port = 1; Static Redispool () { try { //For the password IP port of the Redis library redisurlopenid= "Password @ip: port" poolreds = new Pooledredisclientmanager (port, new string[] {configurationmanager.appsettings["Redisurlopenid"]}); } catch (Exception ex) {}}
For the above: write
<summary>
Cache to Redis
</summary>
<param name= "key" >key value </param>
<param name= "Danhaolist" > Detailed information </param>
public static void Enqueuelist (string key, String obj)
{
using (var client = poolreds. Getclient ())
{
Queue usage
if (obj! = null)
{
Client. Additemtolist (key, obj);
}
}
}
For the above: read
<summary>
Reads the current
</summary>
<param name= "Key" ></param>
<returns></returns>
public static string Dequeuemodel (String key)
{
using (var client = poolreds. Getclient ())
{
String Danhao = client. Getitemfromlist (key, 0);
return Danhao;
}
}
<summary>
Determine if there is currently a record
</summary>
<param name= "Key" ></param>
<returns></returns>
public static long GetListCount (string key)
{
using (var client = poolreds. Getclient ())
{
Long Count = client. GetListCount (key);
return count;
}
}
This is inserted into a list.
INSERT into the unified kjgz2016-04-08 list.
The list can also be inserted into many records. A key for many value. Can record a lot of things. A very useful kind of
The layout is not very good. Hey... And there's the back!
Redis Simple Read and write