HAProxy Enterprise Documentation 2.0r1

show cache

Show cache status.

Description

Query the Runtime API with show cache to display cache information.

Examples

Create a cache in your HAProxy Enterprise config file and attach the cache to a backend:

cache mycache
   total-max-size 4095   # MB
   max-object-size 10000 # bytes
   max-age 30            # seconds

backend be_api
    # Get from cache / put in cache
    http-request cache-use mycache
    http-response cache-store mycache

    # server list
    server s1 172.25.0.10:8080 check

Use socat to query the HAProxy Enterprise Runtime API:

$ echo "show cache" | \
   sudo socat stdio unix-connect:/var/run/hapee-2.0/hapee-lb.sock
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:

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

The second line of output breaks down as:

0x7fcad7c960c0 hash:3075548050 size:363 (1 blocks), refcount:0, expire:10

Output

Description

0x7fcad7c960c0

pointer to the cache entry

hash:3075548050

first 32 bits of the hash

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, can be negative if already expired

See also


Next up

show cli level