Redis共通コマンド

9496 ワード

Redis共通コマンド
  • 文字列
  • リスト
  • HASH
  • 無秩序集合
  • 秩序集合
  • 発行購読
  • トランザクション
  • 汎用コマンド
  • 文字列
    SET key value		
    SETNX key value		//  key      ,    1,    0,    
    SETEX key seconds value		//   key       
    MSET key value [key value]
    MSETNX key value [key value]
    GET key
    MGET key [key]
    GETSET key value
    STRLEN key
    APPEND key value		//      
    INCR key
    DECR key
    INCRBY key value
    DECRBY key value
    INCRBYFLOAT key value
    SETRANGE key offset value	//  offset    ,     value
    GETRANGE key start end		//   start - end       
    

    リスト#リスト#
    LPUSH key value
    RPUSH key value
    LPUSHX key value	//  key    ,   
    RPUSHX key value
    LPOP key
    RPOP key
    BLPOP key timeout	//  key      ,      timeout
    BRPOP key timeout
    LLEN key
    LRANGE key start end
    //	  value ,
    //  count < 0  ,        count value ,
    //  count > 0  ,       count value ,
    //  count = 0  ,    value 
    LREM key count value	
    LSET key index value  	//       value 
    LTRIM key start stop	//   start-stop      ,        
    LINSERT key before|after poivt value	//  poivt    |    value 
    LINDEX key index	//   index    
    RPOPLPUSH key key1
    BRPOPLPUSH key key1 timeout
    

    HASH
    HSET key field value 
    HSETNX key field value 
    HMSET key value [key value]
    HGET key field
    HGETALL key
    HLEN key
    HDEL key field
    HINCRBY key field value
    HKEYS key
    HVALS key
    

    むじゅんしゅうごう
    SADD key member [member]
    SREM key
    SMEMBERS key
    SISMEMBER key member
    SCARD key 
    SMOVE key key1 member  //   key  key1  member
    SPOP key [count]  //     [count] member
    SRANDMEMBER key   //       member
    SINTER key [key1]  //   
    SINTERSTORE return_key key [key1] //   ,        return_key  
    SUNION key [key1]  //   
    SUNIONSTORE return_key key [key1] 
    SDIFF key [key1]
    SDIFFSTORE return_key key [key1]
    

    ちくじしゅうごう
    ZADD key score member [score member]
    ZREM key member
    ZCARD key
    ZCOUNT key min max //      min-max     
    ZSCORE key member  //   member   
    ZINCRBY key increment member //   member   
    ZRANGE key start stop //      start-stop   member, score    
    ZREVRANGE key start stop //      start-stop   member, score    
    ZRANGEBYSCORE key min max //      min-max   member, score    
    ZREVRANGEBYSCORE key min max //      min-max   member, score    
    ZRANK key member //   member   ,     
    ZREVRANK key member //   member   ,     
    ZREMRANGEBYRANK key start stop //   rank(  )start-stop     
    ZREMRANGEBYSCORE key min max //   score(  ) min-max     
    ZINTERSTORE return_key numkeys key [key..] //             ,  numkeys  key   ,       return_key 
    ZUNIONSTORE return_key numkeys key [key..] //             ,  numkeys  key   ,      return_key 
    

    サブスクリプションの発行
    PUBLISH channel message	//    message       channel
    SUBSCRIBE channel [channel]  //      
    

    取引
    WATCH key  [key]  //        key,          key   ,       
    UNWATCH key  //    key   
    MULTI		//          
    EXEC		//          
    DISCARD		//     ,         
    

    汎用コマンド
    KEYS * 		//           key
    DEL key		//   key
    EXISTS key  //   key    
    TTL	key		//   key        
    EXPIRE key	//   key     
    TYPE key	//   key