cartodb-redis
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -363,2 +363,15 @@ /** | ||
/** | ||
* Things to know first: | ||
* - We save the limits values in KEYS[1] list. Every limit has 3 values: burst, count and period (in seconds). | ||
* - We could save several limits in the same list. | ||
* - Example: 10 req/second (burst = 10) and 100 req/minute (burst = 50) ----> [10, 10 , 1, 50, 100, 60] | ||
* | ||
* Script explanation: | ||
* - Extract limits values from KEYS[1] list | ||
* - loop over limit values and call to redis cell every 3 values (3 values == 1 limit), saving the result in | ||
* results variable (a lua table) | ||
* - The key used by redis cell is the result of concatening KEYS[2], ":" and the limit index | ||
* - Returns the result of every limit or an empty lua table if there aren't limits | ||
*/ | ||
me.rateLimitLuaScript = | ||
@@ -377,3 +390,4 @@ 'local results = {} ' + | ||
' resultsCounter = resultsCounter + 1 ' + | ||
' results[resultsCounter] = redis.call("CL.THROTTLE", KEYS[2], limits[1], limits[2], v) ' + | ||
' local redisCellKey = KEYS[2] .. ":" .. i/3 ' + | ||
' results[resultsCounter] = redis.call("CL.THROTTLE", redisCellKey, limits[1], limits[2], v) ' + | ||
' end ' + | ||
@@ -380,0 +394,0 @@ 'end ' + |
{ | ||
"name": "cartodb-redis", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "./lib/carto_metadata.js", | ||
@@ -5,0 +5,0 @@ "description": "A Node.js based lib to interact with cartodb redis databases", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30206
544