Reference
show cache
On this page
Show cache status.
Description Jump to heading
Query the Runtime API with show cache
to display cache information.
Examples Jump to heading
Create a cache in your load balancer config file and attach the cache to a backend:
haproxy
cache mycachetotal-max-size 4095 # MBmax-object-size 10000 # bytesmax-age 30 # secondsbackend be_api# Get from cache / put in cachehttp-request cache-use mycachehttp-response cache-store mycache# server listserver s1 172.25.0.10:8080 check
haproxy
cache mycachetotal-max-size 4095 # MBmax-object-size 10000 # bytesmax-age 30 # secondsbackend be_api# Get from cache / put in cachehttp-request cache-use mycachehttp-response cache-store mycache# server listserver s1 172.25.0.10:8080 check
Use socat
to query the load balancer Runtime API:
nix
echo "show cache" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show cache" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
outputtext
0x7fcad7c9603a: api_cache (shctx:0x7fcad7c96000, available blocks:4193280)0x7fcad7c960c0 hash:3075548050 size:363 (1 blocks), refcount:0, expire:10
outputtext
0x7fcad7c9603a: api_cache (shctx:0x7fcad7c96000, available blocks:4193280)0x7fcad7c960c0 hash:3075548050 size:363 (1 blocks), refcount:0, expire:10
These two lines of output are explained in the tables below.
The first line breaks down as follows:
outputtext
0x7fcad7c9603a: api_cache (shctx:0x7fcad7c96000, available blocks:4193280)
outputtext
0x7fcad7c9603a: api_cache (shctx:0x7fcad7c96000, available blocks:4193280)
Output| Description-----|-----`0x7fcad7c9603a:`| pointer to the cache structure`api\_cache`| cache name`shctx:0x7fcad7c96000`| pointer to the mmap area (shctx)`available blocks:4193280`| number of blocks available for reuse in the shctx
Output| Description-----|-----`0x7fcad7c9603a:`| pointer to the cache structure`api\_cache`| cache name`shctx:0x7fcad7c96000`| pointer to the mmap area (shctx)`available blocks:4193280`| number of blocks available for reuse in the shctx
The second line of output breaks down as:
outputtext
0x7fcad7c960c0 hash:3075548050 vary:0x0011223344556677 size:363 (1 blocks), refcount:0, expire:10
outputtext
0x7fcad7c960c0 hash:3075548050 vary:0x0011223344556677 size:363 (1 blocks), refcount:0, expire:10
Output| Description-----|-----`0x7fcad7c960c0`| pointer to the cache entry`hash:3075548050`| first 32 bits of the hash`vary:0x0011223344556677`| secondary hash of the entry in case of vary. Available as of version `2.4r1`.`size:363`| size of the object in bytes`(1 blocks)`| number of blocks used for the object`refcount:0`| number of transactions using the entry`expire:10`| expiration time
Output| Description-----|-----`0x7fcad7c960c0`| pointer to the cache entry`hash:3075548050`| first 32 bits of the hash`vary:0x0011223344556677`| secondary hash of the entry in case of vary. Available as of version `2.4r1`.`size:363`| size of the object in bytes`(1 blocks)`| number of blocks used for the object`refcount:0`| number of transactions using the entry`expire:10`| expiration time
See also Jump to heading
Do you have any suggestions on how we can improve the content of this page?