public async Task DictionaryIncr() { var dict = new RedisDictionary <string, long>(GlobalSettings.Default, "dict"); await dict.Delete(); (await dict.Increment("hogehoge", 100)).Is(100); (await dict.Increment("hogehoge", 100)).Is(200); (await dict.Increment("hogehoge", -100)).Is(100); (await dict.Get("hogehoge")).Value.Is(100); (await dict.IncrementLimitByMax("hogehoge", 40, 150)).Is(140); (await dict.IncrementLimitByMax("hogehoge", 40, 150)).Is(150); (await dict.IncrementLimitByMin("hogehoge", -40, 100)).Is(110); (await dict.IncrementLimitByMin("hogehoge", -40, 100)).Is(100); var dict2 = new RedisDictionary <string, double>(GlobalSettings.Default, "dict2"); await dict2.Delete(); (await dict2.Increment("hogehoge", 100.5)).Is(100.5); (await dict2.Increment("hogehoge", 100.0)).Is(200.5); (await dict2.Increment("hogehoge", -100.0)).Is(100.5); (await dict2.Get("hogehoge")).Value.Is(100.5); (await dict2.IncrementLimitByMax("hogehoge", 40.1, 150.9)).Is(140.6); (await dict2.IncrementLimitByMax("hogehoge", 40.3, 150.9)).Is(150.9); (await dict2.IncrementLimitByMin("hogehoge", -40.1, 100.9)).Is(110.8); (await dict2.IncrementLimitByMin("hogehoge", -40.3, 100.9)).Is(100.9); }
public async Task DictionaryIncr() { var dict = new RedisDictionary<string, long>(GlobalSettings.Default, "dict"); await dict.Delete(); (await dict.Increment("hogehoge", 100)).Is(100); (await dict.Increment("hogehoge", 100)).Is(200); (await dict.Increment("hogehoge", -100)).Is(100); (await dict.Get("hogehoge")).Value.Is(100); (await dict.IncrementLimitByMax("hogehoge", 40, 150)).Is(140); (await dict.IncrementLimitByMax("hogehoge", 40, 150)).Is(150); (await dict.IncrementLimitByMin("hogehoge", -40, 100)).Is(110); (await dict.IncrementLimitByMin("hogehoge", -40, 100)).Is(100); var dict2 = new RedisDictionary<string, double>(GlobalSettings.Default, "dict2"); await dict2.Delete(); (await dict2.Increment("hogehoge", 100.5)).Is(100.5); (await dict2.Increment("hogehoge", 100.0)).Is(200.5); (await dict2.Increment("hogehoge", -100.0)).Is(100.5); (await dict2.Get("hogehoge")).Value.Is(100.5); (await dict2.IncrementLimitByMax("hogehoge", 40.1, 150.9)).Is(140.6); (await dict2.IncrementLimitByMax("hogehoge", 40.3, 150.9)).Is(150.9); (await dict2.IncrementLimitByMin("hogehoge", -40.1, 100.9)).Is(110.8); (await dict2.IncrementLimitByMin("hogehoge", -40.3, 100.9)).Is(100.9); }