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

RedisClient.type method | Bun module | Bun

RedisClient.type method | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/RedisClient/typeMtype

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/RedisClient/typeMtype

method

RedisClient.typetype(key: KeyLike): Promise'string' | 'stream' | 'set' | 'none' | 'list' | 'zset' | 'hash'>;

Determine the type of value stored at key

The TYPE command returns the string representation of the type of the value stored at key. The different types that can be returned are: string, list, set, zset, hash and stream.

@param key

The key to check

@returns

Promise that resolves with the type of value stored at key, or "none" if the key doesn't exist

await redis.set("mykey", "Hello");
console.log(await redis.type("mykey")); // "string"

await redis.lpush("mylist", "value");
console.log(await redis.type("mylist")); // "list"

await redis.sadd("myset", "value");
console.log(await redis.type("myset")); // "set"

await redis.hset("myhash", "field", "value");
console.log(await redis.type("myhash")); // "hash"

console.log(await redis.type("nonexistent")); // "none"
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.type method | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method bun.RedisClient.type | Bun