WebZC10/_Code/Common/LibCache.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Xml.Linq;

namespace Tc
{
    public class LibCache
    {
        /// <summary>
        /// 缓存时间(天)
        /// </summary>
        public static int c_day = 10;

        /// <summary>
        /// 清空指定名称的缓存
        /// </summary>
        /// <param name="cache_name"></param>
        public static void remove(string cache_name)
        {
            HttpContext.Current.Cache.Remove(cache_name);
        }

        #region 分类表缓存

        /// <summary>
        /// 分类表缓存名称
        /// </summary>
        public static string tc_fenlei = "tc_fenlei";

        /// <summary>
        /// 获取分类名称
        /// </summary>
        /// <param name="bianhao"></param>
        /// <returns></returns>
        public static string get_fenlei_name(int id)
        {
            return get_fenlei(id).Name.GetString();
        }

        /// <summary>
        /// 获取分类table
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public static DataTable get_fenlei_dt(string where)
        {
            DataTable dt = new DataTable();
            if (HttpContext.Current.Cache[tc_fenlei] == null)
            {
                dt = BLL.TcFenlei.Instance.GetList("").Tables[0];
                HttpContext.Current.Cache.Insert(tc_fenlei, dt, null, DateTime.Now.AddDays(c_day), TimeSpan.Zero);
            }
            else
            {
                dt = HttpContext.Current.Cache[tc_fenlei] as DataTable;
            }
后面还有 155 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。