Skip to content

FIX: Fix memcached-tool script file#804

Open
cheesecrust wants to merge 1 commit intonaver:developfrom
cheesecrust:internal/memcached-tool
Open

FIX: Fix memcached-tool script file#804
cheesecrust wants to merge 1 commit intonaver:developfrom
cheesecrust:internal/memcached-tool

Conversation

@cheesecrust
Copy link
Copy Markdown
Contributor

@cheesecrust cheesecrust commented Nov 11, 2024

🔗 Related Issue

⌨️ What I did

  • 오픈소스 memcached 서버에 stats cachedump <bucket> <items>를 실행하면 ITEM foo [6 b; 1176415152 s] 값을 반환합니다.(이때의 b 앞의 숫자는 키 포함 항목 크기(바이트)를 의미하고, s 앞의 숫자는 Expiration timestamp(arcus의 exptime 과 같습니다.) 입니다.)
    그리고 memcached-tool에서는 key 마다 항목의 바이트 크기를 보여주었습니다.
  • 하지만, arcus memcached 서버는 stats cachedump <bucket> <items>를 실행하게 되면 ITEM arcus [acctime=22, exptime=0]와 같이 출력됩니다.
  • 따라서, cachedump가 출력하는 형태가 오픈소스 memcahed와는 달라짐에 따라 arcus-memcached 서버에서 반환하는 exptime을 추출하여 보여주기 위해 정규식을 (/^ITEM (\S+) \[(.*?exptime=(\d+)\]/) 이와 같이 수정하였습니다.

Comment thread scripts/memcached-tool Outdated
@ing-eoking ing-eoking requested a review from namsic November 12, 2024 00:27
@cheesecrust cheesecrust force-pushed the internal/memcached-tool branch from bcc0111 to ba37532 Compare November 12, 2024 00:52
@namsic namsic removed their request for review November 12, 2024 01:05
@cheesecrust cheesecrust force-pushed the internal/memcached-tool branch from ba37532 to 6f5f9ad Compare November 12, 2024 04:50
@cheesecrust
Copy link
Copy Markdown
Contributor Author

  • memcached-tool을 실행하게 되면
print "add $k $flags $keyexp{$k} $len\r\n$val\r\n";

위와 같은 포멧으로 출력됩니다.
따라서 아래와 같은 결과를 반환합니다.

  Dumping memcache contents
    Number of buckets: 1
    Number of items  : 1
  Dumping bucket 0 - 1 total items
  add key 0 529 5
  cache

따라서 이때 529가 exptime 입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants