ajaxcacheattribute.cs

来自「AJAX开发工具包」· CS 代码 · 共 41 行

CS
41
字号
using System;

namespace AjaxPro
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
	public class AjaxServerCacheAttribute : Attribute
	{
		private TimeSpan cacheDuration;
		private bool isCacheEnabled = false;
	
		public AjaxServerCacheAttribute(int seconds)
		{
			if(seconds > 0)
			{
				cacheDuration = new TimeSpan(0, 0, 0, seconds, 0);
				isCacheEnabled = true;
			}
		}

		#region Internal Properties

		internal bool IsCacheEnabled
		{
			get
			{
				return isCacheEnabled;
			}
		}

		internal TimeSpan CacheDuration
		{
			get
			{
				return cacheDuration;
			}
		}

		#endregion
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?