Ejemplo n.º 1
0
        public string Get(PageEntity page, HttpRequestBase request)
        {
            var setting = GetSetting();

            if (setting.Enable && (page.IsStaticCache ?? false) && !request.IsAuthenticated)
            {
                var data = _dataArchivedService.Get(GetCacheKey(page, request));

                if (data != null && (setting.CacheHours == 0 || data.CreateDate.Value.AddHours(setting.CacheHours) > DateTime.Now))
                {
                    return(data.Data);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
 public T Get <T>(string key) where T : class, new()
 {
     return(_settingCache.GetOrAdd(key, k => _dataArchivedService.Get <T>(k, () => new T())) as T);
 }
Ejemplo n.º 3
0
 public T Get <T>(string key) where T : class, new()
 {
     return(_dataArchivedService.Get <T>(key, () => new T()));
 }
Ejemplo n.º 4
0
 public AlipayService(IOptions <AlipayOptions> alipayOptions, IDataArchivedService dataArchivedService)
 {
     Options    = dataArchivedService.Get(SettingKey, () => alipayOptions.Value);
     _aopClient = new DefaultAopClient(Options.Gatewayurl, Options.AppId, Options.PrivateKey, "json", "1.0",
                                       Options.SignType, Options.AlipayPublicKey, Options.CharSet, Options.IsKeyFromFile);
 }