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