~

Paging using Redis

Make use of Redis sorted set for paging.

This is my way to bypass database for paging. It's not perfect, just purely quick hacks.

Each record has created_at_ms, I use this as score for Redis sorted set, also build a string representation of record to store in sorted set.

What field need for query will be used for string representation, for example request_id|user_id|created_at_ms|updated_at_ms|status

The problem is once you make a string representation, it's kinda hardcoded. If you want to add new field to filter, you will need to migrate from old string representation to new one.


Source code is available on GitHub