Object built-in object

Object RedisSortedSet

Redis database client SortedSet object, this object is the client that contains the specified key, and the database can only be operated by calling its method

SortedSet object used to manipulate Redis , creation method:

1 2 3
var db = require("db"); var rdb = new db.openRedis("redis-server"); var set = rdb.getSortedSet("test");

Inheritance

Member function

add

Add one or more member elements and their score values ​​to the ordered set

1
Integer RedisSortedSet.add(Object sms);

Call parameters:

  • sms : Object, specify the member/score object to be added

Return result:

  • Integer , the number of new members successfully added, excluding those updated and existing members

Add one or more member elements and their score values ​​to the ordered set

1
Integer RedisSortedSet.add(...sms);

Call parameters:

  • sms : ..., specify the member/score list to be added

Return result:

  • Integer , the number of new members successfully added, excluding those updated and existing members

score

Returns the score value of member member in an ordered set

1
Buffer RedisSortedSet.score(Buffer member);

Call parameters:

  • member : Buffer , specify the member to be queried

Return result:

  • Buffer , the score value of the member member, expressed as a string

incr

Add the increment num to the score value of the member of the ordered set

1 2
Buffer RedisSortedSet.incr(Buffer member, Long num = 1);

Call parameters:

  • member : Buffer , specify the member to be modified
  • num : Long, specify the value to be added

Return result:

  • Buffer , the new score value of the member member, expressed as a string

remove

Remove one or more member elements in the ordered set

1
Integer RedisSortedSet.remove(Array members);

Call parameters:

  • members : Array, specify the array of elements to be removed

Return result:

  • Integer , the number of elements successfully removed, not including ignored elements

Remove one or more member elements in the ordered set

1
Integer RedisSortedSet.remove(...members);

Call parameters:

  • members : ..., specify the list of elements to be removed

Return result:

  • Integer , the number of elements successfully removed, not including ignored elements

len

Returns the number of elements in an ordered set

1
Integer RedisSortedSet.len();

Return result:

  • Integer , returns the length of the ordered set

count

Returns the number of members in an ordered set with a score value between min and max (including the score value equal to min or max by default)

1 2
Integer RedisSortedSet.count(Integer min, Integer max);

Call parameters:

  • min : Integer, the minimum score of the specified statistics
  • max : Integer, the maximum score of the specified statistics

Return result:

  • Integer , the number of members whose score value is between min and max

range

Return to the ordered set, the members in the specified interval, and the positions of the members are sorted by the increasing score value (from small to large)

1 2 3
NArray RedisSortedSet.range(Integer start, Integer stop, Boolean withScores = false);

Call parameters:

  • start : Integer, specify the starting index of the query, 0 means the first element, -1 means the last element
  • stop : Integer, specify the end index of the query, 0 means the first element, -1 means the last element
  • withScores : Boolean, specify whether to include score in the result

Return result:

  • NArray , a list of ordered set members with a score value (optional) in the specified interval

rangeRev

Return to the ordered set, the members in the specified range, and the positions of the members are sorted according to the decreasing score value (from large to small)

1 2 3
NArray RedisSortedSet.rangeRev(Integer start, Integer stop, Boolean withScores = false);

Call parameters:

  • start : Integer, specify the starting index of the query, 0 means the first element, -1 means the last element
  • stop : Integer, specify the end index of the query, 0 means the first element, -1 means the last element
  • withScores : Boolean, specify whether to include score in the result

Return result:

  • NArray , a list of ordered set members with a score value (optional) in the specified interval

rank

The rank of the member in the ordered set. The members of the ordered set are arranged in the order of increasing score value (from small to large)

1
Integer RedisSortedSet.rank(Buffer member);

Call parameters:

  • member : Buffer , specify the member to be queried

Return result:

  • Integer , member If member is a member of an ordered set of keys, return the rank of member. If member is not a member of the ordered set key, return nil

rankRev

The rank of the member in the ordered set. The members of the ordered set are arranged in the order of decreasing score value (from large to small)

1
Integer RedisSortedSet.rankRev(Buffer member);

Call parameters:

  • member : Buffer , specify the member to be queried

Return result:

  • Integer , member If member is a member of an ordered set of keys, return the rank of member. If member is not a member of the ordered set key, return nil

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String RedisSortedSet.toString();

Return result:

  • String , returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

1
Value RedisSortedSet.toJSON(String key = "");

Call parameters:

  • key : String, unused

Return result:

  • Value , returns a value containing JSON serializable