using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using XdCxRhDW.Core.Api; namespace XdCxRhDW.WebApi.Service { /// /// 测试Service /// public class DetectService { private static readonly object thisLock = new object(); Dictionary keyValues = new Dictionary(); /// /// /// public DetectService() { int code = this.GetHashCode(); } /// /// 存储token /// /// /// public void Add(string token, XcorrUtils xcorr) { lock (thisLock) { keyValues.Add(token, xcorr); } } /// /// 移除totken /// /// public void Remove(string token) { lock (thisLock) { keyValues.Remove(token); } } /// /// /// /// public XcorrUtils Get(string token) { lock (thisLock) { if (keyValues.ContainsKey(token)) { return keyValues[token]; } else { return null; } } } } }