public Task SetAsync(GpuName gpuName) { if (gpuName == null || !gpuName.IsValid()) { return(TaskEx.CompletedTask); } var db = _connection.GetDatabase(); return(db.HashSetAsync(_redisKeyGpuName, gpuName.ToString(), VirtualRoot.JsonSerializer.Serialize(gpuName))); }
public Task DeleteAsync(GpuName gpuName) { if (gpuName == null || !gpuName.IsValid()) { return(TaskEx.CompletedTask); } var db = _connection.GetDatabase(); return(db.HashDeleteAsync(_redisKeyGpuName, gpuName.ToString())); }
public void GpuNameTest() { HashSet <GpuName> hashSet = new HashSet <GpuName>(); GpuName gpuName1 = new GpuName { Name = "580 Series", TotalMemory = NTKeyword.ULongG * 8 }; hashSet.Add(gpuName1); Console.WriteLine(gpuName1.ToString()); GpuName gpuName2 = new GpuName { Name = "580 Series", TotalMemory = (ulong)(NTKeyword.ULongG * 7.9) }; hashSet.Add(gpuName2); Console.WriteLine(gpuName2.ToString()); Assert.AreEqual(gpuName1.GetHashCode(), gpuName2.GetHashCode()); Assert.AreEqual(1, hashSet.Count); }