Beispiel #1
0
        public ContentResult MetricsKey()
        {
            LocalCacheProvider cacheProvider = new LocalCacheProvider();
            string             cacheKey      = "Fx.Manage.Dashboard.MetricsKey";
            string             result        = cacheProvider.GetCache <string>(cacheKey);

            if (string.IsNullOrEmpty(result))
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                List <MetricsKey>    list       = logic.GetMetricsKeys();
                List <string>        keys       = new List <string>();
                foreach (MetricsKey key in list)
                {
                    keys.Add(key.Key);
                }
                result = serializer.Serialize(keys);
                if (!string.IsNullOrEmpty(result))
                {
                    cacheProvider.SetCache <string>(cacheKey, result, DateTime.Now.AddDays(1));
                }
            }
            return(Content(result));
        }