Last active
April 19, 2017 21:07
-
-
Save fritzy/7310712 to your computer and use it in GitHub Desktop.
Appending to a Redis List, deleting entries to the left past a maximum size.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--EVAL "this script" 1 key_name new_item max_size | |
local key = KEYS[1]; | |
local item, max = unpack(ARGV); | |
redis.call('RPUSH', key, item); | |
redis.call('LTRIM', key, -max, -1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment