Returns | New average value |
---|---|
Keys |
|
Args |
|
> evalsha 399fddde578fd9cb924edce746c783e8340d8251 2 score:avg score:count 80 "80" > evalsha 399fddde578fd9cb924edce746c783e8340d8251 2 score:avg score:count 100 "90" > evalsha 399fddde578fd9cb924edce746c783e8340d8251 2 score:avg score:count 75 "85" > evalsha 399fddde578fd9cb924edce746c783e8340d8251 2 score:avg score:count 98 "88.25" > evalsha 399fddde578fd9cb924edce746c783e8340d8251 2 score:avg score:count 98 "90.2" > evalsha 399fddde578fd9cb924edce746c783e8340d8251 2 score:avg score:count 98 "91.5" > get score:avg "91.5" > get score:count "6"
local currentval = tonumber(redis.call('get', KEYS[1])) or 0 local count = redis.call('incr', KEYS[2]) currentval = tostring(currentval * (count - 1)/count + (ARGV[1]/count)) redis.call('set', KEYS[1], currentval) return currentval
399fddde578fd9cb924edce746c783e8340d8251
← More scripts from the Memetria Library
All scripts on this site are in the public domain, unless otherwise noted, and are provided without warranty express or implied. Memetria make no claim for the effectiveness, safety, security or quality of the scripts contained within.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.