
Memcache::getExtendedStats 메소드는 Memcache 확장 통계를 반환하는 메소드입니다.
이 메소드는 다음과 같은 파라미터를 받습니다.
- $memcache: Memcache 객체
- $prefix: 통계를 반환할 prefix (기본값은 '')
- $all: 모든 통계를 반환할지 여부 (기본값은 false)
이 메소드는 다음과 같은 형태의 리턴값을 반환합니다.
- array: 확장 통계
이 메소드를 사용하여 얻을 수 있는 확장된 통계의 종류는 다음과 같습니다.
- hit_ratio: hit ratio
- bytes_read: 읽은 바이트 수
- bytes_written: 쓴 바이트 수
- evictions:_evictions
- bytes: 바이트 수
- curr_connections: 현재 연결 수
- total_connections: 총 연결 수
- connection_structures: 연결 구조 수
- cmd_get: get 명령어 수
- cmd_set: set 명령어 수
- cmd_flush: flush 명령어 수
- cmd_stats: stats 명령어 수
- cmd_touch: touch 명령어 수
- get_hits: get 명령어 hit 수
- get_misses: get 명령어 miss 수
- delete_hits: delete 명령어 hit 수
- delete_misses: delete 명령어 miss 수
- incr_hits: incr 명령어 hit 수
- incr_misses: incr 명령어 miss 수
- decr_hits: decr 명령어 hit 수
- decr_misses: decr 명령어 miss 수
- cas_misses: cas 명령어 miss 수
- cas_hits: cas 명령어 hit 수
- cas_badval: cas 명령어 badval 수
예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$memcache = new Memcache();
$memcache->addServer('localhost', 11211);
$stats = $memcache->getExtendedStats();
print_r($stats);
이 코드는 Memcache 객체를 생성하고, localhost:11211 서버에 연결합니다. 그리고 getExtendedStats 메소드를 사용하여 확장 통계를 반환받고, print_r 함수를 사용하여 통계를 출력합니다.
2025-07-14 03:30