30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Update Cache Vary Rules

litespeed/update-cache-vary changes the cookies and groups that make LiteSpeed keep a separate cached copy of a page.

Read litespeed/get-cache-vary first, and change one thing at a time.

At a glance

Abilitylitespeed/update-cache-vary
ToolsetLiteSpeed Cache — toolset/litespeed
GroupLiteSpeed Cache › Page Cache
RequiresLiteSpeed Cache, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI Abilities Manager 0.0.34 and later

One change, then test

A vary rule decides when LiteSpeed keeps a separate cached copy of a page. Get it wrong and one visitor’s page is served to another — a logged-in user’s dashboard to a stranger, one customer’s cart to the next. That failure does not announce itself; it shows up as a support message from somebody who saw a name that was not theirs.

The advice to change one thing at a time is not caution for its own sake. Vary rules interact: adding a cookie that is already covered by a group does nothing, removing one that a plugin depends on breaks that plugin only for cached visitors, and the symptoms of both are identical from the outside.

After any change, purge and then test with two different sessions — two browsers, or one browser and one private window. A single session cannot demonstrate that copies are being kept apart, because there is only one copy to see.

Adding a vary dimension multiplies the number of cached copies. A rule that splits on a cookie with many values can turn a small cache into a very large one, and the hit rate falls accordingly.

The write is a patch, not a replacement. Send one key and one key changes; everything else in the area is left alone. The response names the keys that actually moved, so a payload that matched the existing values comes back with an empty list rather than a misleading success.

Input

NameTypeRequiredWhat it is
settingsobjectYesA map of setting key to new value. Keys outside this area are refused, and the refusal lists what the area accepts.

What comes back

NameTypeWhat it is
updatedarrayThe keys that actually changed. An empty array means every value you sent was already set.
settingsarrayEvery setting in the area after the write, in the read shape.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Add our currency cookie to the vary rules.

It resolves to one call:

{
  "ability": "litespeed/update-cache-vary",
  "parameters": {
    "settings": { "cache-vary_cookies": ["site_currency"] }
  }
}

Worth knowing

  • Purge after changing vary rules. Existing entries were keyed under the old ones.
  • Test with two separate sessions. One proves nothing.
  • Every vary dimension multiplies the number of cached copies.
  • Change one rule at a time.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading