Hi All,I am implementing feed(post) like twitter. I have created feed(post) and stored in sorted set with timestamp(created_at) as a score.I am using Rails and Redis as my technology stack.Now, I am facing two issues.Problems:1) Pagination : How do I implement pagination?Initially I am using zrevrange(key, min, max).Now problem is let say my data(pool) is [10,9,8,7,6,5,4,3,2,1]parameters from clients are page=0 and page_size=2 then command will bezrevrange(key, 0, 2*1 -1 ) and result is [10,9].similarly for next request page=1 and page_size=2 then command will bezrevrange(key, 2, 2*2 -1 ) and result is [8,7]but problem is here, let say feed data has been added by others users thenpool will contain [14,13,12,11,10,9,8,7,6,5,4,3,2,1] .now next page=2 and page_size=2 request result is wrongzrevrange(key, 4, 2*3 -1 ) and result is [10,9] which is a wrong.Please, suggest me how do I implement pagination.
2) score value:which key(timestamp or post's primary key) should I take as score to store data in redistimestamp = post's created_at.to_i => many posts may be save in same timestamp value if numbers of post is large.post's id = Post's model's primary key => post may be deleted then I may not be perform calculation based on id.Please, suggest me better way to do this.
//Emil
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "Redis DB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redis-db/Bo3xcylLr30/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redis-db+u...@googlegroups.com.