lmcache quota#
The lmcache quota command manages per-salt cache quotas on a running
LMCache server. Quotas are soft limits: exceeding a quota triggers eviction
on the next cycle (~1 s) rather than rejecting writes.
lmcache quota <sub-command> [options]
$ lmcache quota -h
usage: lmcache quota [-h] {set,get,list,delete} ...
Manage per-salt cache quotas on the LMCache server.
subcommands:
set Create or update a quota for a cache_salt
get Show the quota and current usage for a cache_salt
list List all registered quotas and their usage
delete Remove a quota for a cache_salt
options:
-h, --help show this help message and exit
set#
Create or update a quota for a given cache_salt.
lmcache quota set <salt> --limit-gb <GB> [--url <URL>]
Example:
$ lmcache quota set tenant1 --limit-gb 10.5
================ Quota Set =================
Cache salt: tenant1
Limit (GB): 10.5
Status: ok
=============================================
Options:
Flag |
Required |
Description |
|---|---|---|
|
Yes |
The |
|
Yes |
Quota limit in gigabytes (non-negative float). |
|
No |
LMCache HTTP server URL (default: |
|
No |
Output format: |
|
No |
Save output to a file (uses the format chosen by |
|
No |
Suppress stdout output. Exit code only. |
get#
Show the current quota limit and live usage for a specific cache_salt.
lmcache quota get <salt> [--url <URL>]
Example:
$ lmcache quota get tenant1
================ Quota Info ================
Cache salt: tenant1
Limit (GB): 10.5
Current usage (GB): 3.27
Exists: True
=============================================
Options:
Flag |
Required |
Description |
|---|---|---|
|
Yes |
The |
|
No |
LMCache HTTP server URL (default: |
|
No |
Output format: |
|
No |
Save output to a file. |
|
No |
Suppress stdout output. |
list#
List all registered quotas along with their current usage.
lmcache quota list [--url <URL>]
Example:
$ lmcache quota list
=================== Quota List ====================
--- Salt: tenant1 ---
Cache salt: tenant1
Limit (GB): 10.5
Current usage (GB): 3.27
--- Salt: _default ---
Cache salt: _default
Limit (GB): 5.0
Current usage (GB): 1.82
===================================================
JSON output:
$ lmcache quota list --format json
{
"title": "Quota List",
"sections": {
"quota_0": {
"label": "Salt: tenant1",
"metrics": {
"cache_salt": "tenant1",
"limit_gb": 10.5,
"current_usage_gb": 3.27
}
},
"quota_1": {
"label": "Salt: _default",
"metrics": {
"cache_salt": "_default",
"limit_gb": 5.0,
"current_usage_gb": 1.82
}
}
}
}
Options:
Flag |
Required |
Description |
|---|---|---|
|
No |
LMCache HTTP server URL (default: |
|
No |
Output format: |
|
No |
Save output to a file. |
|
No |
Suppress stdout output. |
delete#
Remove a quota entry for a given cache_salt. Any bytes still cached
under this salt become over-budget on the next eviction cycle and will be
evicted (effective limit drops to 0).
lmcache quota delete <salt> [--url <URL>]
Example:
$ lmcache quota delete tenant1
============== Quota Delete ===============
Cache salt: tenant1
Status: removed
===========================================
Options:
Flag |
Required |
Description |
|---|---|---|
|
Yes |
The |
|
No |
LMCache HTTP server URL (default: |
|
No |
Output format: |
|
No |
Save output to a file. |
|
No |
Suppress stdout output. |
Exit Codes#
Code |
Meaning |
|---|---|
|
Success. |
|
Error (connection failure, server error, bad arguments). |
The _default Salt#
The LMCache server uses an empty string ("") as the cache_salt for
anonymous / un-salted traffic. Since empty strings cannot appear in URL path
parameters, the HTTP API (and this CLI) uses the sentinel _default in
its place.
# Set a 5 GB quota for anonymous traffic
lmcache quota set _default --limit-gb 5.0
# Check usage
lmcache quota get _default
Common Patterns#
Provision quotas for multiple tenants:
for tenant in tenant_a tenant_b tenant_c; do
lmcache quota set "$tenant" --limit-gb 8.0
done
Monitor usage in a script:
USAGE=$(lmcache quota get tenant1 --format json | jq '.metrics.current_usage_gb')
LIMIT=$(lmcache quota get tenant1 --format json | jq '.metrics.limit_gb')
echo "tenant1: ${USAGE} / ${LIMIT} GB"
Revoke access (evict all cached data for a salt):
# Deleting the quota causes all data under this salt to be evicted
lmcache quota delete tenant1