Object built-in object

ObjectRedisSortedSet

RedisDatabase client SortedSet object. This object is the client containing the specified key. Only by calling its method will the database be operated.

used to operateRedisSortedSet object, creation method:

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

inheritance relationship

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, specifies the member/score object to be added

Return results:

  • Integer, the number of new members successfully added, excluding existing members that were updated

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 results:

  • Integer, the number of new members successfully added, excluding existing members that were updated

score

Returns the score value of member in the ordered set

1
Buffer RedisSortedSet.score(Buffer member);

Call parameters:

  • member:Buffer, specify the member to be queried

Return results:

  • Buffer, member member's score value, expressed in string form

incr

Add increment num to the score value of 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, specifies the value to be added

Return results:

  • Buffer, the new score value of the member member, expressed in string form

remove

Remove one or more member elements from an ordered set

1
Integer RedisSortedSet.remove(Array members);

Call parameters:

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

Return results:

  • Integer, the number of successfully removed elements, excluding ignored elements

Remove one or more member elements from an ordered set

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

Call parameters:

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

Return results:

  • Integer, the number of successfully removed elements, excluding ignored elements

len

Returns the number of elements in a sorted set

1
Integer RedisSortedSet.len();

Return results:

  • Integer, returns the length of the sorted set

count

Returns the number of members in the sorted set whose score value is between min and max (default includes score value equal to min or max)

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

Call parameters:

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

Return results:

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

range

Returns the members in the specified range in the ordered set. The positions of the members are sorted by increasing score value (from small to large).

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

Call parameters:

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

Return results:

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

rangeRev

Returns the members in the specified range in the ordered set. The positions of the members are sorted by 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, specifies the starting subscript of the query, 0 represents the first element, -1 represents the last element
  • stop: Integer, specifies the end index of the query, 0 represents the first element, -1 represents the last element
  • withScores: Boolean, specifies whether to include score in the result

Return results:

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

rank

The ranking of members in an ordered set. The members of the ordered set are arranged in 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 results:

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

rankRev

The ranking of members in an ordered set. The members of the ordered set are arranged in descending order of score value (from large to small).

1
Integer RedisSortedSet.rankRev(Buffer member);

Call parameters:

  • member:Buffer, specify the member to be queried

Return results:

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

toString

Returns the string representation of the object. Generally, "[Native Object]" is returned. The object can be re-implemented according to its own characteristics.

1
String RedisSortedSet.toString();

Return results:

  • String, returns the string representation of the object

toJSON

Returns a JSON format representation of the object, generally returning a collection of readable properties defined by the object.

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

Call parameters:

  • key: String, not used

Return results:

  • Value, returns a value containing JSON serializable