/// <summary>
 /// 获取缓存实例
 /// </summary>
 /// <returns></returns>
 public static SimpleCacheProvider GetInstance()
 {
     if (_instance == null)
     {
         lock (_lockObj) { _instance = _instance ?? new SimpleCacheProvider(); }
     }
     ;                                                                                              //使用单例模式以确保并发时实例始终是同一个
     return(_instance);
 }
        /// <summary>
        /// 获取JS票据
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static JSTicket FetchJSTicket()
        {
            var cache    = SimpleCacheProvider.GetInstance();
            var jsTicket = cache.GetCache <JSTicket>(ConstVars.CACHE_JS_TICKET_KEY);

            if (jsTicket == null || AccessToken.Begin.AddSeconds(ConstVars.CACHE_TIME) < DateTime.Now) //jsTicket为null表示不存在或过期,或AccessToken过期
            {
                String apiurl = FormatApiUrlWithToken(Urls.get_jsapi_ticket);                          //该方法参看《钉钉开发系列(三)API的调用》
                jsTicket = Analyze.Get <JSTicket>(apiurl);
                cache.SetCache(ConstVars.CACHE_JS_TICKET_KEY, jsTicket, ConstVars.CACHE_TIME - 500);   //增加500的时间差以防与AccessToken错位过期
            }
            return(jsTicket);
        }