REST API cache custom endpoints and invalidation




Wordpress LScache Plugin: REST API cache custom endpoints and invalidation

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi guys, I had a few questions about your REST API cache implementation 1. Is this caching done at the server level without going through PHP and the database etc? Or is it using WordPress object caching, like some of the other REST API cache plugins? 2. Are custom endpoints automatically cached? Is there a way to manually add and remove which endpoints will be cached? 3. How is cache invalidation handled? For example if a CRM plugin that uses custom database tables (not custom post types) has API endpoints and a contact record is updated, how can we tell LiteSpeed to flush the cache for that endpoint? Can we do this programatically via a function? 4. Is there any affect on authentication? For example if an endpoint is restricted to logged in users and were using JWT authentication for the API, is there any danger of cached results for logged in users being served to non-logged-in users? Thanks 1. LiteSpeed cache is done on server side, its not a object caching (but we also support object cache feature). So after the page cache, the request will not go through PHP and database. 2. If its generated by WP REST API, it will be cached automatically. You can remove the endpoint by adding the URI on LiteSpeed Setting > Exclude > Do Not Cache URIs 3. REST cache will be auto purged depends on your setting(LiteSpeed Cache > Purge > Auto Purge Rules), you also can use our APIs and Hooks to setup programmatic purge via a function. 4. Logged in user will be cached privately if you are using the native WordPress auth method. You can understand more about private cache on this blog post. Great, thanks! This sounds very promising. So if private / logged in user caching is enabled, does that mean it is safe to cache things like wp-admin and the WooCommerce checkout page? Regarding the API cache, I have a few plugins that dont use custom post types and that use custom REST API endpoints. Are there any hooks I can use to add these endpoints, in case they are not added automatically? Cheers > So if private / logged in user caching is enabled, does that mean it is safe to cache things like wp-admin and the WooCommerce checkout page? Yes, our plug also compitable with WooCommerce, but if youve installed some 3rd woocommerce plugin, it might affect the caching function, please test on it and feel free to let us know if theres any error. We keep improving the compatibility. > Regarding the API cache? Please try without any hook and check the response header to see does it showing X-Litespeed-Cache: hit on the second call first. If you find its showing hit you do not need to do any setup.



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference