Exemple #1
0
 public ActionCooldownFilterImpl(IOptionsCache _optionsCache, IModelMetadataProvider _modelMetadataProvider, IActionCooldownService _actionCooldownService, ActionCooldownType actionCooldownType)
 {
     this._optionsCache          = _optionsCache;
     this._modelMetadataProvider = _modelMetadataProvider;
     this._actionCooldownService = _actionCooldownService;
     this._actionCooldownType    = actionCooldownType;
 }
        public void SetCooldown(ActionCooldownType actionCooldownType, string ip)
        {
            long cooldowntime = 0;
            var  options      = _optionsCache.Get().Result;

            switch (actionCooldownType)
            {
            case ActionCooldownType.CommentsPost:
                cooldowntime = long.Parse(options.postcommentscd);
                break;
            }
            _cache.Set(actionCooldownType + ip, "0", cooldowntime);
        }
Exemple #3
0
 public ActionCooldownFilter(ActionCooldownType actionCooldownType) : base(typeof(ActionCooldownFilterImpl))
 {
     Arguments = new object[] { actionCooldownType };
 }
 public bool IsCoolingCompletion(ActionCooldownType actionCooldownType, string ip)
 {
     return(_cache.Get(actionCooldownType + ip) == null ? true : false);
 }