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.
Search the reference...
/
method
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.
The key to check
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"
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →