OBJECT encoding

Redis Developer Course Redis Technical Support Redis Enterprise Server

key에 대한 정보 조회

사용법은 OBJECT encoding key 이다.

encoding data type

  • Strings: int, embstr, raw
  • Lists: 버전 3.2.0 이전 ziplist(small lists), linkedlist
    버전 3.2.0 부터 quicklist 하나로 통일되어 사용됨.
  • Sets: intset(integers and small sets), hashtable
  • Sorted Sets: ziplist(small zsets), skiplist
  • Hashes: ziplist(small hashes), hashtable

Strings data type : int(integer), embstr(small string), raw

  • int: value가 정수임을 나타낸다. integer, 실수(소숫점 포함)는 string으로 분류된다. 숫자가 0으로 시작하면 string이다. 예를 들어 123은 int이고 0123은 embstr이다.
  • embstr: value가 string이고 44문자 이하임을 나타낸다. embedded string, embstr은 3.0부터 표시된다. 이전 버전은 raw로 표시되었다.
  • raw: value가 string이고 45문자 이상임을 나타낸다.

Example Strings

명령>set key 1234
결과>OK
명령>object encoding key
결과>int
명령>append key Hello
결과>OK
명령>object encoding key
결과>embstr
명령>set key 01234
결과>OK
명령>object encoding key
결과>embstr
명령>set key 12.34
결과>OK
명령>object encoding key
결과>embstr
명령>set key 0123456789012345678901234567890123456789
결과>OK
명령>object encoding key
결과>raw

애니메이션 보기



Lists data type : ziplist(small lists), linkedlist

  • ziplist: member 갯수가 512개 까지이거나, 값의 길이가 64까지는 ziplist이다.
  • linkedlist: member 갯수가 513개 이상이거나, 값의 길이가 65부터는 linkedlist이다.
  • 이것은 redis.conf에 list-max-ziplist-entries 512, list-max-ziplist-value 64 로 설정할 수 있다.
  • 레디스 버전 3.2.0 이전에 인코딩 타입이 이 두 가지 였는데, 3.2.0 부터는 이 두 가지를 합한 quicklist 하나만 사용된다.

Example Lists: 버전 3.2.0 이전

명령>llen mylist1
결과>512
명령>object encoding mylist1
결과>ziplist
명령>llen mylist2
결과>513
명령>object encoding mylist2
결과>linkedlist

Example Lists: 버전 3.2.0 이후

명령>rpush mylist3 value1 value2
결과>(integer) 2
명령>object encoding mylist3
결과>quicklist


Sets: intset(integers and small sets), hashtable

  • intset: value가 모두 정수이고, member 갯수가 512개 까지 intset이다. value가 0으로 시작하거나, 소숫점을 포함하면 hashtable로 변환된다.
  • hashtable: value가 string이거나, member 갯수가 513개 이상은 hashtable이다.
  • 이것은 redis.conf에 set-max-intset-entries 512 로 설정할 수 있다.

Example Sets

명령>sadd myset 1 2 3
결과>3
명령>object encoding mylist1
결과>intset
명령>sadd myset 4.1
결과>1
명령>object encoding myset
결과>hashtable


Sorted Sets: ziplist(small zsets), skiplist

  • ziplist: member 갯수가 128개 까지이거나, 값의 길이가 64까지는 ziplist이다.
  • skiplist: member 갯수가 129개 이상이거나, 값의 길이가 65부터는 skiplist이다.
  • 이것은 redis.conf에 zset-max-ziplist-entries 128, zset-max-ziplist-value 64 로 설정할 수 있다.

Example Sets

명령>zcard myzip1
결과>128
명령>object encoding myzip1
결과>ziplist
명령>zcard myzip2
결과>129
명령>object encoding myzip2
결과>skiplist


Hashes: ziplist(small hashes), hashtable

  • ziplist: member 갯수가 512개 까지이거나, 값의 길이가 64까지는 ziplist이다.
  • hashtable: member 갯수가 513개 이상이거나, 값의 길이다 65부터는 hashtable이다.
  • 이것은 redis.conf에 hash-max-ziplist-entries 512, hash-max-ziplist-value 64 로 설정할 수 있다.

Example Sets

명령>hlen myhash1
결과>512
명령>object encoding myhash1
결과>ziplist
명령>hlen myhash2
결과>513
명령>object encoding myhash2
결과>hashtable


명령문

OBJECT encoding key

  • 이 명령은 version 2.2.3 부터 사용할 수 있다.
  • 논리적 처리 소요시간 : O(1)
관련 명령 TYPE

<< OBJECT OBJECT encoding OBJECT idletime >>

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

혹시 처음이세요?
레디스게이트에는 레디스에 대한 많은 정보가 있습니다.
레디스 소개, 명령어, SQL, 클라이언트, 서버, 센티널, 클러스터 등이 있습니다.
혹시 필요한 정보를 찾기 어려우시면 redisgate@gmail.com로 메일 주세요.
제가 찾아서 알려드리겠습니다.
 
close
IP를 기반으로 보여집니다.