Home  >  Q&A  >  body text

Can the length of the key be set for the sortset ordered collection in Redis?

I want to achieve the effect of ranking the top 100 in real time.
When the number of places reaches 100, the 101st piece of data will be automatically sorted when added to the sortset collection, but the 101st one after sorting needs to be deleted by coding yourself.
Does sortset have the function of limiting the key length? For example, the key is limited to 100. After 101 comes in, it is sorted and then the 101st one with the smallest weight is deleted.

phpcn_u1582phpcn_u15822733 days ago839

reply all(1)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:20:20

    Ordered sets can delete members within a certain range, insert new data, and reorder, and then delete the excess parts of the sort. For details, please take a look at the command set of ordered sets to find what you want

    reply
    0
  • Cancelreply