memcached stats
命令用於返回統計資訊例如pid
(程序號)、版本號、連線數等。
語法:stats
命令的基本語法格式如下:
stats
例項
在以下例項中,我們使用了stats
命令來輸出memcached
服務資訊。
stats
stat pid 1162
stat uptime 5022
stat time 1415208270
stat version 1.4.14
stat libevent 2.0.19-stable
stat pointer_size 64
stat rusage_user 0.096006
stat rusage_system 0.152009
stat curr_connections 5
stat total_connections 6
stat connection_structures 6
stat reserved_fds 20
stat cmd_get 6
stat cmd_set 4
stat cmd_flush 0
stat cmd_touch 0
stat get_hits 4
stat get_misses 2
stat delete_misses 1
stat delete_hits 1
stat incr_misses 2
stat incr_hits 1
stat decr_misses 0
stat decr_hits 1
stat cas_misses 0
stat cas_hits 0
stat cas_badval 0
stat touch_hits 0
stat touch_misses 0
stat auth_cmds 0
stat auth_errors 0
stat bytes_read 262
stat bytes_written 313
stat limit_maxbytes 67108864
stat accepting_conns 1
stat listen_disabled_num 0
stat threads 4
stat conn_yields 0
stat hash_power_level 16
stat hash_bytes 524288
stat hash_is_expanding 0
stat expired_unfetched 1
stat evicted_unfetched 0
stat bytes 142
stat curr_items 2
stat total_items 6
stat evictions 0
stat reclaimed 1
end
這裡顯示了很多狀態資訊,下邊詳細解釋每個狀態項:
memcached stats items
命令用於顯示各個slab
中item
的數目和儲存時長(最後一次訪問距離現在的秒數)。
語法:stats items
命令的基本語法格式如下:
stats items
例項stats items
stat items:1:number 1
stat items:1:age 7
stat items:1:evicted 0
stat items:1:evicted_nonzero 0
stat items:1:evicted_time 0
stat items:1:outofmemory 0
stat items:1:tailrepairs 0
stat items:1:reclaimed 0
stat items:1:expired_unfetched 0
stat items:1:evicted_unfetched 0
end
memcached stats slabs
命令用於顯示各個slab
的資訊,包括chunk
的大小、數目、使用情況等。
語法:stats slabs
命令的基本語法格式如下:
stats slabs
例項stats slabs
stat 1:chunk_size 96
stat 1:chunks_per_page 10922
stat 1:total_pages 1
stat 1:total_chunks 10922
stat 1:used_chunks 1
stat 1:free_chunks 10921
stat 1:free_chunks_end 0
stat 1:mem_requested 71
stat 1:get_hits 0
stat 1:cmd_set 1
stat 1:delete_hits 0
stat 1:incr_hits 0
stat 1:decr_hits 0
stat 1:cas_hits 0
stat 1:cas_badval 0
stat 1:touch_hits 0
stat active_slabs 1
stat total_malloced 1048512
end
memcached stats sizes
命令用於顯示所有item
的大小和個數。
該資訊返回兩列,第一列是item
的大小,第二列是item
的個數。
語法:stats sizes
命令的基本語法格式如下:
stats sizes
例項
stats sizes
stat 96 1
end
memcached flush_all
命令用於清理快取中的所有key=>value
(鍵=>值) 對。
該命令提供了乙個可選引數time
,用於在制定的時間後執行清理快取操作。
語法:flush_all
命令的基本語法格式如下:
flush_all [time] [noreply]
例項
清理快取:
set runoob 0 900 9
memcached
stored
get runoob
value runoob 0 9
memcached
endflush_all
okget runoob
end
memcached 學習筆記
鳴謝 菜鳥教程 memcached 是一套高效能的 分布式記憶體物件快取系統。注意,memcache不是資料庫。1.1 特點 a.協議簡單 使用文字協議和二進位制協議,協議簡單,效能高效.b.基於 libevent 的事件處理 libevent 是個程式庫,它將 linux 的 epoll bsd ...
Memcached 學習筆記(一)
memcached 學習筆記 一 什麼是memcached?memcashed專案由dango interactive公司開發,最初為了加速livejournal訪問速度而開發,後來成為廣泛應用的開源專案。它是基於記憶體工作的鍵 值儲存型的資料庫。操作簡單,但是能解決很多問題。在過去的幾年,廣泛用於...
Memcached學習筆記02
memcached set命令用於將value 資料值 儲存在指定的key 鍵 中。如果set的key已經存在,該命令可以更新該key所對應的原來的資料,也就是實現更新的作用。語法 set命令的基本語法格式如下 set key flags exptime bytes noreply value引數說...