Here’s a short LUA script that is pushes a new item to the end of a list, deleting as many left-most entries in order to enforce a maximum size.
🌎 http://gists.fritzy.io/2013/11/04/redis-rpush-max