예제 #1
0
        public Dictionary <string, string> GetRateLimitHeaders()
        {
            ThrottleInfo throttleInfo = getThrottleInfoFromCache();

            int requestsRemaining = Math.Max(RequestLimit - throttleInfo.RequestCount, 0);

            var headers = new Dictionary <string, string>();

            headers.Add("X-RateLimit-Limit", RequestLimit.ToString());
            headers.Add("X-RateLimit-Remaining", RequestsRemaining.ToString());
            headers.Add("X-RateLimit-Reset", toUnixTime(throttleInfo.ExpiresAt).ToString());
            return(headers);
        }
예제 #2
0
        public Dictionary <string, string> GetRateLimitHeaders()
        {
            ThrottleInfo throttleInfo = GetThrottleInfoFromCache();

            int requestsRemaining = Math.Max(RequestLimit - throttleInfo.RequestCount, 0);

            var headers = new Dictionary <string, string>
            {
                { "X-RateLimit-Limit", RequestLimit.ToString() },
                { "X-RateLimit-Remaining", RequestsRemaining.ToString() },
                { "X-RateLimit-Reset", throttleInfo.ExpiresAt.ToString(CultureInfo.InvariantCulture) }
            };

            return(headers);
        }