You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
821 B

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Apewer.Web
  5. {
  6. /// <summary>Cron 特性。</summary>
  7. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
  8. public sealed class CronAttribute : Attribute
  9. {
  10. internal const int DefaultInterval = 60000;
  11. private int _internval;
  12. /// <summary>两次 Cron 执行的间隔毫秒数。</summary>
  13. public int Interval
  14. {
  15. get { return _internval; }
  16. private set { _internval = value < 1000 ? 1000 : value; }
  17. }
  18. /// <summary>创建 Cron 特性,可指定两次 Cron 执行的间隔毫秒数。</summary>
  19. public CronAttribute(int interval = DefaultInterval)
  20. {
  21. Interval = interval;
  22. }
  23. }
  24. }