温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/bun/RedisClient/zrange
点击访问原文链接

RedisClient.zrange method | Bun module | Bun

RedisClient.zrange method | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/RedisClient/zrangeMzrange

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/RedisClient/zrangeMzrange

method

RedisClient.zrangezrange(key: KeyLike,start: string | number,stop: string | number,withscores: 'WITHSCORES'): Promise[string, number][]>;

Return a range of members in a sorted set with their scores

@param key

The sorted set key

@param start

The starting index

@param stop

The stopping index

@param withscores

Return members with their scores

@returns

Promise that resolves with an array of [member, score, member, score, ...]

const results = await redis.zrange("myzset", 0, -1, "WITHSCORES");
// Returns ["member1", "1.5", "member2", "2.5", ...]
zrange(key: KeyLike,start: string | number,stop: string | number,byscore: 'BYSCORE'): Promisestring[]>;

Return a range of members in a sorted set by score

@param key

The sorted set key

@param start

The minimum score (use "-inf" for negative infinity, "(" prefix for exclusive)

@param stop

The maximum score (use "+inf" for positive infinity, "(" prefix for exclusive)

@param byscore

Indicates score-based range

@returns

Promise that resolves with an array of members with scores in the range

// Get members with score between 1 and 3
const members = await redis.zrange("myzset", "1", "3", "BYSCORE");

// Get members with score > 1 and
const members2 = await redis.zrange("myzset", "(1", "3", "BYSCORE");
zrange(key: KeyLike,start: string,stop: string,bylex: 'BYLEX'): Promisestring[]>;

Return a range of members in a sorted set lexicographically

@param key

The sorted set key

@param start

The minimum lexicographical value (use "-" for start, "[" for inclusive, "(" for exclusive)

@param stop

The maximum lexicographical value (use "+" for end, "[" for inclusive, "(" for exclusive)

@param bylex

Indicates lexicographical range

@returns

Promise that resolves with an array of members in the lexicographical range

// Get members lexicographically from "a" to "c" (inclusive)
const members = await redis.zrange("myzset", "[a", "[c", "BYLEX");
zrange(key: KeyLike,start: string | number,stop: string | number,...options: string[]): Promisestring[]>;

Return a range of members in a sorted set with various options

@param key

The sorted set key

@param start

The starting value (index, score, or lex depending on options)

@param stop

The stopping value

@param options

Additional options (BYSCORE, BYLEX, REV, LIMIT offset count, WITHSCORES)

@returns

Promise that resolves with an array of members (or with scores if WITHSCORES)

// Get members by score with limit
const members = await redis.zrange("myzset", "1", "10", "BYSCORE", "LIMIT", "0", "5");

// Get members in reverse order with scores
const reversed = await redis.zrange("myzset", "0", "-1", "REV", "WITHSCORES");
zrange(key: KeyLike,start: string | number,stop: string | number): Promisestring[]>;

Return a range of members in a sorted set

Returns the specified range of elements in the sorted set stored at key. The elements are considered to be ordered from the lowest to the highest score by default.

@param key

The sorted set key

@param start

The starting index (0-based, can be negative to count from end)

@param stop

The stopping index (0-based, can be negative to count from end)

@returns

Promise that resolves with an array of members in the specified range

// Get all members
const members = await redis.zrange("myzset", 0, -1);

// Get first 3 members
const top3 = await redis.zrange("myzset", 0, 2);
Referenced typestype KeyLike = string | ArrayBufferView | Blob

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

RedisClient.zrange method | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method bun.RedisClient.zrange | Bun