Cache rules
A cache rule controls how the edge caches the responses for URLs that match its URL operator. It sets a TTL and, optionally, a set of per-URL location features that override your property-level defaults for the matching requests.
Fields
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | Display name. Max length 200. |
pattern | string | Yes | The match value. Max length 500. See match operators. |
matchType | integer | Yes | Equals=0, Contains=1, StartsWith=2, EndsWith=3, Regex=4. |
ttlSeconds | integer | Yes | Cache lifetime in seconds. Default 300 (5 minutes), minimum 0. |
order | integer | Yes | Lower runs first. See how rules work. |
isEnabled | boolean | Yes | Toggle without deleting. |
description | string | No | Optional free-text note. |
featuresJson | string (JSON) | No | Per-rule location features. See Location features. |
:::warning A TTL of 0 means do not cache
ttlSeconds: 0 effectively bypasses the cache for matching requests — nothing is stored. Use it to force matching URLs (for example, a cart or checkout path) to always go to the origin.
:::
Endpoints
POST /api/Property/{id}/rules/cache
PUT /api/Property/{id}/rules/cache/{ruleId}
POST returns 201 "Cache rule created successfully."; PUT returns 200 "Cache rule updated successfully.". See the full API reference.
Example
Cache everything under /static/ for one hour (POST /api/Property/42/rules/cache):
{
"name": "Cache static assets",
"pattern": "/static/",
"matchType": 2,
"ttlSeconds": 3600,
"description": "1h cache for static files",
"order": 0,
"isEnabled": true,
"featuresJson": "{\"bypass_cookies\":[\"wordpress_logged_in\"],\"cache_key\":{\"include_query_string\":true,\"include_headers\":[\"Accept-Language\"],\"include_cookies\":[]},\"minification\":{\"html\":true,\"css\":true,\"js\":false},\"webp\":{\"enabled\":true,\"quality\":80,\"only_if_smaller\":true}}"
}
curl -X POST "https://api.paradarum.com/api/Property/42/rules/cache" \
-H "X-Api-Key: pdm_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Cache static assets",
"pattern": "/static/",
"matchType": 2,
"ttlSeconds": 3600,
"order": 0,
"isEnabled": true
}'
:::note featuresJson is a JSON string
featuresJson is a string containing JSON, not a nested object — so its quotes are escaped inside the request body (as shown above). If you only need a TTL, omit featuresJson entirely.
:::
Location features
The optional featuresJson string overrides property-level defaults for the URLs this rule matches. In the panel these live under a collapsible Location Features (Optional) panel. Every key is optional — include only what you want to override.
{
"bypass_cookies": ["cookie_name"],
"cache_key": { "include_query_string": true, "include_headers": [], "include_cookies": [] },
"minification": { "html": true, "css": false, "js": false },
"webp": { "enabled": true, "quality": 80, "only_if_smaller": true }
}
| Key | Shape | Purpose |
|---|---|---|
bypass_cookies | array of cookie names | If any listed cookie is present on the request, the cache is bypassed (for example, a logged-in session cookie). |
cache_key | object | Customizes what goes into the cache key. |
cache_key.include_query_string | boolean | Include the query string in the cache key. |
cache_key.include_headers | array of header names | Add these request headers to the cache key (for example, Accept-Language). |
cache_key.include_cookies | array of cookie names | Add these cookies to the cache key. |
minification | object | Minify matching responses. |
minification.html | css | js | boolean | Enable minification per content type. |
webp | object | Auto-convert images to WebP. |
webp.enabled | boolean | Turn WebP conversion on. |
webp.quality | integer | WebP quality, 1–100, default 80. |
webp.only_if_smaller | boolean | Only serve WebP when it is smaller than the original. |
:::tip Bypass the cache for logged-in users
Listing your CMS session cookie (such as wordpress_logged_in) under bypass_cookies keeps anonymous visitors on the fast cached path while logged-in users always see fresh, personalized pages. See the WordPress examples for a full setup.
:::
Next steps
- WordPress rule examples — real cache-rule setups including bypass cookies.
- Match operators — pick the right operator for your URLs.
- API reference — full request and response schemas.