C:\Program Files\redis\redis-cli.exe
Using Servicestack.redis
Class Program
{
static void Main (string[] args)
{
Redisclient client = new Redisclient ("127.0.0.1", 6379);
Client. Flushall ();//Clear data
Client. Changedb (0);//Use Db0
Stopwatch sw=new Stopwatch ();
Sw. Reset ();
Sw. Start ();
list<keyvaluepair<string, string>> keyvaluepairs = new list<keyvaluepair<string, string>> ();
Insert 50W data into hash, up to 10W each time, hash up to 80w bar
for (int i2 = 0; i2 <= 4; i2++)
{
Keyvaluepairs.clear ();
for (int i22 = 0; i22 < 1000*100; i22++)
{
Keyvaluepairs.add (New keyvaluepair<string, string> ("key" + (i22+i2*1000*1000). ToString (), i22. ToString ()));
}
Client. Setrangeinhash ("xxx", keyvaluepairs);
}
Sw. Stop ();
var ts1 = sw. elapsedmilliseconds;//about 2 seconds.
Sw. Reset ();
Sw. Start ();
var dict= client. Getallentriesfromhash ("xxx");//Read All values
Sw. Stop ();
var ts2 = sw. elapsedmilliseconds;//about 1 seconds.
}
Redis Learning-Getting Started