0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[golang]RedisでKEYSしたい

Posted at

環境

  • go 1.12.5
  • redigo 1.6.0

コード

redis.Strings という便利関数が用意されているので、それを使う。

keys, err := redis.Strings(conn.Do("KEYS", "hoge:*"))
if err != nil {
    // 何かエラー処理
}
for _, key := range keys {
   fmt.Println(key)
}

一般的な注意喚起としては、キーが増えてきたら、トラフィックを食うし、応答速度は落ちるしでボトルネックになりがちなので、そこは注意して利用したい。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?