Exemplo n.º 1
0
 public ActionCooldownFilterImpl(IOptionsCache _optionsCache, IModelMetadataProvider _modelMetadataProvider, IActionCooldownService _actionCooldownService, ActionCooldownType actionCooldownType)
 {
     this._optionsCache          = _optionsCache;
     this._modelMetadataProvider = _modelMetadataProvider;
     this._actionCooldownService = _actionCooldownService;
     this._actionCooldownType    = actionCooldownType;
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public ActionCooldownFilter(ActionCooldownType actionCooldownType) : base(typeof(ActionCooldownFilterImpl))
 {
     Arguments = new object[] { actionCooldownType };
 }
Exemplo n.º 4
0
 public bool IsCoolingCompletion(ActionCooldownType actionCooldownType, string ip)
 {
     return(_cache.Get(actionCooldownType + ip) == null ? true : false);
 }