ll
LL (list long format)
Redis 開発者教育の申込
|
Redis 定期点検/技術サポートRedis Technical Support |
Redis エンタープライズサーバーRedis Enterprise Server |
|---|
キー(key)を取得
使い方は ll または ll pattern です。
Example
| コマンド> | ll オプションがなければすべての key を取得 |
| 結果> |
0) type|key|value|last_update_time|expire_time 1) set|myset1|5|[2025-05-07 17:11:45]|[] 2) string|mystr2|value30|[2025-05-07 17:11:29]|[2025-08-15 17:12:38] 3) string|mystr4|value20|[2025-05-07 17:11:29]|[] 4) list|mylist2|5|[2025-05-07 17:11:40]|[] 5) string|mystr3|value50|[2025-05-07 17:11:29]|[] 6) set|myset2|5|[2025-05-07 17:11:51]|[] 7) string|mystr1|value10|[2025-05-07 17:11:29]|[2025-05-17 17:12:32] 8) string|mystr5|value40|[2025-05-07 17:11:29]|[] 9) list|mylist1|5|[2025-05-07 17:11:35]|[] |
項目説明
- type: キーのデータタイプを表示します。データタイプは string/list/set/zset/hash/stream です。
- key: キーを表示します。
- value: string の場合は値(value)を表示し、他のデータタイプは値の件数を表示します。
- last_update_time: キーが入力された日時(create time)または最後の修正日時(last update time)を表示します。
この項目は open source バージョンにはなく、Enterprise バージョンで管理する項目です。 - expire_time: expire コマンドで有効期限が設定されている場合、有効期限日時を表示します。
glob-style patternを使用できます。
- * : すべての文字にマッチ(match): h*llo -> hllo, heeeello, etc
- ? : 1文字にマッチ(match): h?llo -> hallo, hello, hxllo, etc
- [alphabet] : 角括弧内の文字にマッチ(match): h[ae]llo -> hallo, hello
- [^e] : 角括弧内の文字を除いてマッチ(match):
h[^e]llo -> hallo, hbllo, ... ただし hello は除外されます。
- [a-c] : 角括弧内の文字範囲でマッチ(match): h[a-c]llo -> hallo, hbllo, hcllo
- \ : 上で使った特殊文字(*?[^])をそのまま使うには前に \ を付けてください。
Example
| コマンド> | ll * key 取得 |
| 結果> |
0) type|key|value|last_update_time|expire_time 1) set|myset1|5|[2025-05-07 17:11:45]|[] ... 9) list|mylist1|5|[2025-05-07 17:11:35]|[] |
| コマンド> | ll myset* myset で始まる key 取得 |
| 結果> |
0) type|key|value|last_update_time|expire_time 1) set|myset1|5|[2025-05-07 17:11:45]|[] 2) set|myset2|5|[2025-05-07 17:11:51]|[] |
Data type 指定
データタイプを指定して該当キーだけ取得できます。
データタイプを指定して使うことを推奨します。
指定できるデータタイプは string, list, set, zset, hash, stream です。
Example
| コマンド> | ll * list |
| 結果> |
0) type|key|value|last_update_time|expire_time 1) list|mylist2|5|[2025-05-07 17:11:40]|[] 2) list|mylist1|5|[2025-05-07 17:11:35]|[] |
構文
LL [key_pattern] [string|list|set|zset|hash|stream] [COUNT count]
- このコマンドは Ent 7.5.0 から使用できます。
- 時間計算量は O(N) です。N は返されたキー数ではなく、データベースにあるすべてのキー数です。
- redis.conf ll-max パラメータで出力(取得)制限を設けました。
キー数が ll-max 以上の場合、次のようなメッセージが出て取得されません。
"If the number of keys is greater than ll-max, the 'll' command cannot be executed.
To execute, modify the 'CONFIG SET ll-max number' command.
The number of keys can be checked with the 'dbsize' command, and the 'll-max' value can be checked with the 'CONFIG GET ll-max' command."
'CONFIG SET ll-max number' コマンドで値を修正できます。
運用サーバーで使う場合は 'COUNT count' オプションの使用を推奨します。
| 関連コマンド | LS, KEYS |
| << LS | LL | RM >> |
|---|
Email
返事がかかってなれば、メールでお知らせします。
