Song.ServiceImpls/QuestionsMethod/QuestionsCache.cs
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Song.Entities;
using System.Timers;
using WeiSha.Common;
using Song.ServiceInterfaces;
namespace Song.ServiceImpls.QuestionsMethod
{
/// <summary>
/// 试题的缓存
/// </summary>
public class QuestionsCache
{
private static readonly QuestionsCache _questionsCache = new QuestionsCache();
/// <summary>
/// 试题的缓存对象
/// </summary>
public static QuestionsCache Singleton
{
get { return _questionsCache; }
}
/// <summary>
/// 缓存序列
/// </summary>
private List<QuestionsCache_Item> list = new List<QuestionsCache_Item>();
/// <summary>
/// 缓存个数
/// </summary>
public int Count
{
get { return list.Count; }
}
System.Timers.Timer myTimer = null;
private QuestionsCache()
{
int mm = 3; //间隔执行的分钟数
myTimer = new System.Timers.Timer(mm * 60 * 1000);
myTimer.Elapsed += new ElapsedEventHandler(myTimer_Elapsed);
myTimer.Enabled = true;
myTimer.AutoReset = true;
myTimer.Start();
}
/// <summary>
/// 添加试题集
/// </summary>
/// <param name="ques"></param>
/// <param name="expires"></param>
public void Add(List<Questions> ques, int expires)
{
QuestionsCache_Item qcitem = new QuestionsCache_Item(ques, expires);
list.Add(qcitem);
}
/// <summary>
/// 添加试题集
/// </summary>
/// <param name="ques"></param>
/// <param name="expires"></param>
后面还有 325 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
