/// <summary> /// 获取JS票据 /// </summary> /// <param name="url"></param> /// <returns></returns> public static JSTicket FetchJSTicket() { SimpleCacheProvider cache = SimpleCacheProvider.GetInstance(); JSTicket jsTicket = cache.GetCache <JSTicket>(ConstVars.CACHE_JS_TICKET_KEY); if (jsTicket == null || DataType.IsNullOrEmpty(jsTicket.ticket)) { String apiurl = FormatApiUrlWithToken(Urls.get_jsapi_ticket); jsTicket = Analyze.Get <JSTicket>(apiurl); cache.SetCache(ConstVars.CACHE_JS_TICKET_KEY, jsTicket, ConstVars.CACHE_TIME); } return(jsTicket); }
public ICacheProvider CreateCacheProvider(CacheProviderType cacheProviderType) { ICacheProvider cacheProvider; switch (cacheProviderType) { case CacheProviderType.Simple: { cacheProvider = new SimpleCacheProvider(); break; } default: { cacheProvider = new SimpleCacheProvider(); break; } } return(cacheProvider); }