LL   (list long format)

Redis Developer Course Redis Technical Support Redis Enterprise Server

Key를 조회

사용법은 ll 또는 ll pattern 입니다.
'll'은 모든 키를 조회합니다.
이 명령은 Enterprise 서버에서 사용 가능합니다. (use-sql yes/no 관계없이 사용 가능)
👉 명령 개발 의도: 'ls' 명령이 있지만 'use-sql yes'로 설정해야만 사용할 수 있고, 다양한 옵션을 기억하기 어려워 쉽게 사용하지 못하는 경우가 많아, 필요한 항목을 기본으로 보여주고 옵션을 간단히 해서 사용하기 쉽게 만들었다.
✅ 주의 사항: 'keys' 명령과 같이 DB의 모든 키를 full scan 하므로 사용에 주의해야 합니다.

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]|[]

'type' 지정

'type'을 지정하면 각 data type과 해당 type에 속한 키 개수를 보여줍니다.

Example

명령>ll * type
결과> 0) type|count
1) string|5
2) list|2
3) set|2
4) zset|0
5) hash|0
6) module|0
7) stream|0

소트 옵션 지정

  • SORT/ASC/DESC: 키(key)로 소트합니다. SORT/ASC는 오름차순 정렬, DESC는 내림차순 정렬입니다.

Example

명령>ll * sort
결과> 0) type|key|value|last_update_time|expire_time
1) list|mylist1|5|[2025-05-07 17:11:35]|[]
2) list|mylist2|5|[2025-05-07 17:11:40]|[]
3) set|myset1|5|[2025-05-07 17:11:45]|[]
4) set|myset2|5|[2025-05-07 17:11:51]|[]
5) string|mystr1|value10|[2025-05-07 17:11:29]|[2025-05-17 17:12:32]
6) string|mystr2|value30|[2025-05-07 17:11:29]|[2025-08-15 17:12:38]
7) string|mystr3|value50|[2025-05-07 17:11:29]|[]
8) string|mystr4|value20|[2025-05-07 17:11:29]|[]
9) string|mystr5|value40|[2025-05-07 17:11:29]|[]
명령>ll * string sort
결과> 0) type|key|value|last_update_time|expire_time
1) string|mystr1|value10|[2025-05-07 17:11:29]|[2025-05-17 17:12:32]
2) string|mystr2|value30|[2025-05-07 17:11:29]|[2025-08-15 17:12:38]
3) string|mystr3|value50|[2025-05-07 17:11:29]|[]
4) string|mystr4|value20|[2025-05-07 17:11:29]|[]
5) string|mystr5|value40|[2025-05-07 17:11:29]|[]

명령문

LL   [pattern]   [string|list|set|zset|hash|stream|type]   [sort|asc|desc]

  • 이 명령은 Enterprise version 7.5.0 부터 사용할 수 있다.
  • 논리적 처리 소요시간은 O(N)이다. N은 리턴된 키 개수가 아니고 데이터베이스에 있는 모든 키 개수이다.
  • 이 명령은 'keys' 명령과 같이 DB를 'full scan'해서 서버 성능에 영향을 미치므로 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' 명령으로 값을 수정할 수 있습니다.
    이 명령은 개발/테스트 서버에서 사용하시고, 운영 서버에서는 꼭 필요한 경우가 아니면 자제해 주시기 바랍니다.
관련 명령 LS, KEYS

<< KEYS LL LS >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.

패턴으로 값을 조회하고 삭제할 수 있어요.
리스트에서 "lls mylist user*" 이렇게 조회할 수 있구요.
user가 들어간 값들을 삭제하려면 "lrm mylist user*" 이렇게 하면 됩니다.
List에서는 LLS, LRM, Set에서는 SLS, SRM, ZSet에서는 ZLS, ZRM, Hash에서는 HLS, HRM 을 사용하면 됩니다.
게다가 LS는 소트 기능까지 있습니다. 한번 사용해 보세요. ^^
궁금하신 사항이 있으면 여기로 redisgate@gmail.com 메일 주세요.
 
close
IP를 기반으로 보여집니다.