projectscache-rules
cache-rules set
Update cache rule for a query
Enable or disable caching for a specific query shape, identified by its xxhash64
hash. You can optionally override the TTL (time-to-live) and SWR
(stale-while-revalidate) durations. Omitting --ttl or --swr uses the
project-level defaults. Use pgbeam cache-rules list to find query hashes.
Usage
pgbeam cache-rules set <query-hash> [flags]Options
| Option | Description | Required | Default |
|---|---|---|---|
<query-hash> | Query hash (xxhash64 hex) identifying the query shape. Find this via pgbeam cache-rules list. | Yes | - |
--database-id <value> | ID of the database that owns the query | Yes | - |
--enabled <value> | Whether to enable caching for this query: "true" or "false" | Yes | - |
--ttl <value> | TTL (time-to-live) override in seconds. Omit to use the project default. | No | - |
--swr <value> | SWR (stale-while-revalidate) override in seconds. Omit to use the project default. | No | - |
Global options
All global options (--token, --profile,
--project, --org, --json, --no-color, --debug) are also available on
this command.
Examples
# Enable caching for a query
pgbeam cache-rules set a1b2c3d4 --database-id db_xxx --enabled true
# Enable with custom TTL and SWR
pgbeam cache-rules set a1b2c3d4 --database-id db_xxx --enabled true --ttl 60 --swr 10
# Disable caching for a query
pgbeam cache-rules set a1b2c3d4 --database-id db_xxx --enabled falseOutput
Prints the updated cache rule showing whether caching is enabled, the TTL, and
the SWR duration. With --json, returns the full cache rule entry.