Redis
CtrlK
  • Intro
  • Contributor
    • Contributor
  • Install
    • Mac OS
    • Windows
  • Connection
    • Redis server / client
      • Configuration
    • Node.js
      • createClient
        • options
  • Concept
    • Book
    • Property
    • Data Type
  • Command
    • DB
      • select
      • flushdb
      • flushall
    • Key
      • del
      • keys
      • exists
      • expire
      • ttl
    • String
      • set & get
      • getrange
      • mget
      • mset
      • strlen
      • append
      • incr & decr
      • setex
      • <Scenario>
    • Hash
      • hset & hget & hdel
      • hgetall & hkeys & hvals
      • hmget & hmset
      • hlen
      • hstrlen
      • hscan
      • hincrby
      • hexists
      • hsetnx
      • <Scenario>
    • List
      • rpush & lpush
      • lrange
      • rpop & lpop
      • brpop & blpop
      • rpushx & lpushx
      • rpoplpush
      • brpoplpush
      • lindex
      • lset
      • linsert
      • llen
      • ltrim
      • lrem
      • <Scenario>
    • Set
      • sadd
      • smembers
      • srandmember
      • spop
      • srem
      • scard
      • sdiff
      • sdiffstore
      • sinter
      • sinterstore
      • sunion
      • sunionstore
      • sismember
      • smove
      • sscan
      • <Scenario>
    • Zset
      • zadd
      • zrange
      • zrevrange
      • zcard
      • zscore
      • zcount
      • zincrby
      • zinterstore
      • zunionstore
      • zrangebyscore
      • zrevrangebyscore
      • zrangebylex
      • zrevrangebylex
      • zlexcount
      • zrank
      • zrevrank
      • zrem
      • zremrangebylex
      • zremrangebyscore
      • zremrangebyrank
      • zscan
      • <Scenario>
  • Reference
    • Reference
Powered by GitBook
On this page
  • 1. 基本語法
  • 2. 範例

Was this helpful?

  1. Command
  2. Set

smembers

1. 基本語法

smembers(key, callback)

取得集合內的所有成員。

2. 範例

client.del('food');

const arr = ['apple', 'potato', 'apple', 'onion', 'potato', 'onion']
client.sadd('food', arr);
client.smembers('food', (err, members) => {
    console.log(members);
});
[ 'apple', 'onion', 'potato' ]
PrevioussaddNextsrandmember

Last updated 4 years ago

Was this helpful?