using System; using System.Collections.Generic; using System.Text; namespace Apewer.Web { /// Cron 特性。 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public sealed class CronAttribute : Attribute { internal const int DefaultInterval = 60000; private int _internval; /// 两次 Cron 执行的间隔毫秒数。 public int Interval { get { return _internval; } private set { _internval = value < 1000 ? 1000 : value; } } /// 创建 Cron 特性,可指定两次 Cron 执行的间隔毫秒数。 public CronAttribute(int interval = DefaultInterval) { Interval = interval; } } }