pseudocode for paginating redis query