using System;
using System.Collections.Generic;
using System.Web;

namespace Stat.BLL
{
    /// <summary>
    /// 
    /// </summary>
    public class ViewTop
    {
        private static Stat.IDAL.IViewTop dal = Stat.DALFactory.AbstractFactory.GetInstance().CreateViewTop();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="webid"></param>
        /// <returns></returns>
        public static IList<Model.ViewTop> Get(int webid)
        {
            string cName = "V_Top_" + webid;
            IList<Model.ViewTop> list = new List<Stat.Model.ViewTop>();
            if (HttpContext.Current.Cache.Get(cName) == null)
            {
                list = dal.Get(webid);                //
                HttpContext.Current.Cache.Insert(cName, list, null, DateTime.MaxValue, TimeSpan.FromSeconds(3.0), System.Web.Caching.CacheItemPriority.Low, null);
                return list;
            }
            return (IList<Model.ViewTop>)HttpContext.Current.Cache.Get(cName);//从缓存中读取
        }
    }
}
