Exemplo n.º 1
0
        public Task DeleteAsync(GpuName gpuName)
        {
            if (gpuName == null || !gpuName.IsValid())
            {
                return(TaskEx.CompletedTask);
            }
            var db = _connection.GetDatabase();

            return(db.HashDeleteAsync(_redisKeyGpuName, gpuName.ToString()));
        }
Exemplo n.º 2
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)));
        }
Exemplo n.º 3
0
 public void Remove(GpuName gpuName)
 {
     if (!IsReadied)
     {
         return;
     }
     if (gpuName == null || !gpuName.IsValid())
     {
         return;
     }
     _gpuNameSet.Remove(gpuName);
     _gpuNameRedis.DeleteAsync(gpuName);
 }
Exemplo n.º 4
0
 public void Set(GpuName gpuName)
 {
     if (!IsReadied)
     {
         return;
     }
     if (gpuName == null || !gpuName.IsValid())
     {
         return;
     }
     _gpuNameSet.Add(gpuName);
     _gpuNameRedis.SetAsync(gpuName);
 }
Exemplo n.º 5
0
 bool IGpuName.IsValid()
 {
     return(GpuName.IsValid(this.GpuType, this.Name, this.TotalMemory));
 }