# Cache plugins

In YayCurrency (version 2.4.2 and newer) → go to **Advanced Settings**, you can enable **Compatible with cache plugins** to make it work with your caching system. &#x20;

Enable this option will do these actions:

* Bypass server cache
* Fetch the latest currency data using AJAX
* Save the newest data into the browser cookie

<figure><img src="/files/A4Em4B22zUWAv3o7sS0O" alt=""><figcaption></figcaption></figure>

### Why Does Cache Break Currency Display?

Full-page cache works by storing a static HTML snapshot and serving it to all users, helping the website load faster. However, this is exactly what causes issues with multi-currency.

Currency is dynamic data that varies per visitor, while cache stores a static HTML version.

Factors that influence currency display:

* User cookie
* Geolocation
* Language
* Previously selected currency

Similar to other multi-currency plugins, the caching system needs a special mechanism to ensure the correct currency is displayed for each visitor.

### Compatible with Cache Plugins

This feature allows YayCurrency to function correctly even when the website is using aggressive caching. Rather than requiring the entire website to be "uncached", YayCurrency uses a combination of:

* Client-side refresh
* REST API hydration
* Dynamic currency rendering

This allows the website to still leverage cache for speed, while currency remains accurate for each individual visitor.

YayCurrency is compatible with:

* Server cache
* Reverse proxy cache
* Full-page cache
* CDN cache

Because currency is refreshed after page load via the REST API.

#### What Is Object Cache?

Object cache is a type of cache that stores the results of database queries or PHP data in memory (RAM), typically using Redis or Memcached, rather than caching the entire HTML output like a full-page cache does.

Because YayCurrency handles currency rendering at the client-side layer, server-level object cache does not affect the currency display result for each visitor. Therefore, YayCurrency remains fully stable when object cache is in use.

### Tested Compatible Cache Plugins & Server Cache Solutions

YayCurrency has been tested and confirmed to work reliably with the following popular caching solutions:

* LiteSpeed Cache
* WP Rocket
* W3 Total Cache
* NitroPack
* WP Super Cache
* SG Optimizer
* WP-Optimize
* Cloudflare Cache
* Server Cache / CDN Cache / Object Cache (general)
* And many others

### Cloudflare APO: Is It Compatible?

Yes. YayCurrency is compatible with Cloudflare APO because all currency update logic takes place after the page has loaded, and no uncached HTML is required.

Important Note: When Using Cloudflare APO

Cloudflare APO must not cache YayCurrency's API responses. If these requests are cached, the currency data returned will no longer be accurate for each visitor.

A cache bypass rule must be created for the following endpoint:

```
/wp-json/yaycurrency/v1/caching/*
```

How to create the rule in Cloudflare:

Go to Cloudflare Dashboard → Caching Rules → Create Rule → Set the condition: URI Path contains /wp-json/yaycurrency/v1/caching/ → Set action: Bypass Cache.

{% hint style="warning" %}
**Note:**\
If you are using **another third-party plugin** that *recalculates* the converted prices, this cache compatibility function might not work as intended. WooCommerce Wholesale Pro, WooCommerce Product Add-ons, WooCommerce Name Your Price, Woo Discount Rules, to name a few.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yaycommerce.com/yaycurrency/compatibility/cache-plugins.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
