ihasa 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/ihasa/bucket.rb +1 -1
- data/lib/ihasa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c2f1647dc36aad4a17f01d49748bf40116784c8
|
4
|
+
data.tar.gz: 03c3f6c7bd66c3a33ee7b2fde4c9bd579ded3fc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cfc9af05559770453ce7e4c8d2d5cacdb35851eebdfaa247477f77839cbf9a137e8a844a3baf6d0606eed7d3491b76cc32ec865e4e7d27f27e1f8803c6d957a
|
7
|
+
data.tar.gz: 61ba1b7ef42a2d06a7d15d3ec252fc7042741b01194edfd63b0e5aea2b74e50a787b520f87d42d8028f87ed7e10a99c83f78e6e65f82f9c062188f6db3d75575
|
data/README.md
CHANGED
@@ -5,10 +5,11 @@ Ihasa is a ruby implementation of the [token bucket algorithm](https://en.wikipe
|
|
5
5
|
It provides a way to share your rate/burst limit across multiple servers, as well as a simple interface.
|
6
6
|
|
7
7
|
*Why use Ihasa?*
|
8
|
+
|
8
9
|
1. It's easy to use ([go check the usage section](#usage)
|
9
10
|
2. It supports rate AND burst
|
10
11
|
3. It does not reset all rate limit consumption each new second/minute/hour
|
11
|
-
4. It has [namespaces](namespaces)
|
12
|
+
4. It has [namespaces](#namespaces)
|
12
13
|
|
13
14
|
|
14
15
|
- [Installation](#installation)
|
@@ -111,6 +112,7 @@ class Controller < ActionController::Base
|
|
111
112
|
|
112
113
|
By default, all new buckets use the redis instance hosted at localhost:6379. There is
|
113
114
|
however two way to configure the used redis instance:
|
115
|
+
|
114
116
|
1. Override the `REDIS_URL` env variable. All new buckets will use that instance
|
115
117
|
2. Override the redis url on a bucket creation basis like follow:
|
116
118
|
|
data/lib/ihasa/bucket.rb
CHANGED
@@ -90,10 +90,10 @@ module Ihasa
|
|
90
90
|
#{ALLOWANCE_UPDATE_STATEMENT}
|
91
91
|
local result = #{NOK}
|
92
92
|
if allowance >= 1.0 then
|
93
|
-
#{redis_set(last, 'now')}
|
94
93
|
allowance = allowance - 1.0
|
95
94
|
result = #{OK}
|
96
95
|
end
|
96
|
+
#{redis_set(last, 'now')}
|
97
97
|
#{redis_set(allowance, 'allowance')}
|
98
98
|
return result
|
99
99
|
LUA
|
data/lib/ihasa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ihasa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Ignjatovic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|