Skip to content

Instantly share code, notes, and snippets.

@fritzy
Last active April 19, 2017 21:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fritzy/7310712 to your computer and use it in GitHub Desktop.
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.
--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