public StatisticsServiceTests() { _redisDB = DefaultRedis.Instance; _redisDB.DataFormater = new JsonFormater(); _redisDB.Host.AddWriteHost("redisTestServer", 6381); _redisDB.Flushall(); _statisticsServiceBeetleXRedis = new StatisticsServiceBeetleXRedis(_redisDB); _muxer = ConnectionMultiplexer.Connect("redisTestServer:6381"); _statisticsServiceStackExchangeRedis = new StatisticsServiceStackExchangeRedis(_muxer); }
public async void Get() { await DB.Flushall(); Write(await DB.Get <Employee>("nonexisting")); Write(await DB.Set("emp3", GetEmployee(3))); Write(await DB.Get <Employee>("emp3")); }
public async void Keys() { await DB.Flushall(); var mset = await DB.MSet(("one", 1), ("tow", 2), ("three", 2), ("four", 4)); Write(mset); var keys = await DB.Keys("*o*"); Write(keys); keys = await DB.Keys("t??"); Write(keys); keys = await DB.Keys("*"); Write(keys); }
public async void LIndex() { await DB.Flushall(); var list = DB.CreateList <string>("list1"); var push = await list.Push("World"); Write(push); push = await list.Push("Hello"); Write(push); var lindex = await list.Index(0); Write(lindex); lindex = await list.Index(-1); Write(lindex); lindex = await list.Index(3); Write(lindex); }
public async void HDel() { await DB.Flushall(); var table = DB.CreateHashTable("myhash"); Write(await table.MSet(("emp1", GetEmployee(1)))); Write(await table.Del("emp1")); Write(await table.Del("emp2")); Write(await table.Len()); }
public async void LIndex() { await DB.Flushall(); var list = DB.CreateList <Employee>("employees"); Write(await list.Push(GetEmployee(1))); Write(await list.Push(GetEmployee(2))); Write(await list.Index(0)); Write(await list.Index(-1)); Write(await list.Index(3)); }
public async void HDel() { await DB.Flushall(); var table = DB.CreateHashTable("myhash"); var mset = await table.MSet(("field1", "foo")); Write(mset); var del = await table.Del("field1"); Write(del); del = await table.Del("field2"); Write(del); }
public async void GetSetList() { await DB.Flushall(); Write(await DB.Set("employees", DataHelper.Defalut.Employees)); Write(await DB.Get <List <Employee> >("employees1")); }
public async void SADD() { await DB.Flushall(); var sets = GetSets(); var count = await sets.SAdd("bbs", "discuz.net"); Assert.Equal(1, count); count = await sets.SAdd("bbs", "discuz.net"); Assert.Equal(0, count); count = await sets.SAdd("bbs", "tianya.cn", "groups.google.com"); Assert.Equal(2, count); var items = await sets.SMembers("bbs"); }