public static RedisResult Increment(
string key,
TimeSpan spanSize,
TimeSpan bucketSize,
long throttle,
int increment = 1)
{
RedisKey[] keyArgs = { key };
RedisValue[] valueArgs =
{
DateTime.UtcNow.Ticks / TimeSpan.TicksPerMillisecond, (long)spanSize.TotalMilliseconds,
(long)bucketSize.TotalMilliseconds, increment, throttle
};
RedisResult result = SharedCache.Instance.GetWriteConnection(key)
.GetDatabase(SharedCache.Instance.Db)
.ScriptEvaluate(RateLimiter.RateLimitIncrementHash, keyArgs, valueArgs);
return result;
}