Пример #1
0
        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)));
        }
Пример #2
0
        public Task DeleteAsync(GpuName gpuName)
        {
            if (gpuName == null || !gpuName.IsValid())
            {
                return(TaskEx.CompletedTask);
            }
            var db = _connection.GetDatabase();

            return(db.HashDeleteAsync(_redisKeyGpuName, gpuName.ToString()));
        }
Пример #3
0
        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);
        }