php - Use Redis for a timeout queue or leaderboard -


i want use redis this, if (hypothetically) accepted sql:

select id, data, processing_due qtable processing_due < now() 

where processing_due integer timestamp of sort.

the idea remove completed "jobs" like:

delete qtable id = $someid 

which redis commands use on producing ("insert") , consuming ("select, delete from") end?

i find redis can used queue, don't want answers in strictly order inserted, rather based on if "now" past processing_due.

i imagine same problem leaderboard?

(i try wrap head around how redis works , looks simple enough documentation, don't it.)

would decent solution zadd qtable <timestamp> <uuid> , use uuid key store (json) value under it?

you can use sorted set, in score time (an integer you've suggested), , query using zrangebyscore. each member json representation of "fields". example: {id:"1",data:"bla",processing_due:"3198382"}

regarding delete, use zrem when find relevant member delete. pass json string parameter , you're ok.

a possibly better variant hold generated ids member, , in separate string-type key save pairs of ids along json representation of data. remember maintain 2 structs in sync.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -