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.

redisのhsetやhget等、hashの扱いメモ

Last updated at Posted at 2015-10-15

redisのデータ永続化

redis-cli bgsave

※バックグラウンド処理版

redisのデータ全部削除 ※扱い注意!

redis-cli flushall

hashのキーを指定してデータ取得

clearのフィールド名lv200を取得

redis-cli HGET clear lv200

フィールドを指定せずに全部

redis-cli HGETALL clear

hashのフィールドを指定して更新

redis-cli HSET clear lv200 1

hashのフィールドの指定して削除

redis-cli HDEL clear lv200

hashのkey毎削除(扱い注意

redis-cli DEL clear

トラブルシューティング

hset時に、下記のようなエラーがでたら型違いで、既に同じhash値で登録されている可能性がある

WRONGTYPE Operation against a key holding the wrong kind of value

僕の場合は、hdelやdelで対象を削除して、インポートし直せばOKでした。

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?