I want to implement numeric limit and offset based pagination in DynamoDB similar to Postgres.
My API look something like this: http://foo.bar/user?offset=50&limit=20
.
What's the best way to do this in Java without risking OutOfMemoryError
considering DynamoDB uses ExclusiveStartKey
and LastEvaluatedKey
to paginate?
EDIT:
Let's assume offset based pagination is a hard-requirement and I don't know the 'prior' page. My API contract have offset
and limit
query params as described above. I'm not looking for "don't do offset based pagination" answers.