Title: File &#8211; Cache Management
Last modified: September 5, 2018

---

# File – Cache Management

 *  Resolved [Nathaniel Meyer](https://wordpress.org/support/users/beansandrice/)
 * (@beansandrice)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/file-cache-management/)
 * I have a website that uses an API to login users.
 * When the user is logged in the header links update.
    But with this plugin, they
   don’t update.
 * I use this plugin for all our clients and was wondering if there is a way to 
   disable the cache for a specific file. Header.php for example.
 * Or Can I trigger a flush when the user is logged in, for example, call a function
   in my functions.php file?
    -  This topic was modified 7 years, 9 months ago by [Nathaniel Meyer](https://wordpress.org/support/users/beansandrice/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [LiteSpeed Lisa](https://wordpress.org/support/users/lclarke/)
 * (@lclarke)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/file-cache-management/#post-10663227)
 * Do you mean that they don’t ever update at all? Or that they don’t update until
   the newly-logged-in user visits another page?
 *  Plugin Support [Hai Zheng⚡](https://wordpress.org/support/users/hailite/)
 * (@hailite)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/file-cache-management/#post-10663432)
 * Our plugin has a hook to wp login process action `set_logged_in_cookie` in `inc/
   vary.class.php`, to set a cookie which can make the logged-in users get a separate
   cache than guest visitors.
 * If your API honors that hook, it will set that cookie. Are you using any other
   ways to login?
 *  Thread Starter [Nathaniel Meyer](https://wordpress.org/support/users/beansandrice/)
 * (@beansandrice)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/file-cache-management/#post-10664848)
 * [@lclarke](https://wordpress.org/support/users/lclarke/)
    They don’t update until
   they visit a page that hasn’t been viewed yet.
 * [@hailite](https://wordpress.org/support/users/hailite/)
    It’s not using any 
   Wp login they don’t have an account for WordPress the account is stored off-site
   and validated in functions.php.
 * Is there a function to trigger a flush from functions.php.
 *  Plugin Support [LiteSpeed Lisa](https://wordpress.org/support/users/lclarke/)
 * (@lclarke)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/file-cache-management/#post-10667312)
 * Hi, [@beansandrice](https://wordpress.org/support/users/beansandrice/)
 * Yes, there is a function to trigger a flush available in our API, but I wouldn’t
   recommend that approach.
 * The best way to handle this, I think, is for you to have separate cached copies
   of the page: one for logged-in users, and one for non-logged-in users. If you
   can set a cookie to distinguish who is a logged-in user, then LSCache can be 
   configured to create a cache vary on that cookie.
 * You’d need to add a line to your .htaccess like this, where “api-login-cookie”
   is the name of the cookie used by the plugin:
 * `RewriteRule .* - [E="cache-vary:api-login-cookie"]`
 * We discussed a similar situation in [this post](https://wordpress.org/support/topic/not-caching-pages-for-specific-users/#post-10485187)
   recently. And [this wiki](https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:developer_guide:cache-vary?s[]=cookie#how_to_instruct_the_server_to_use_a_custom_vary)
   goes into some detail about how it works.
 * Let us know if you have any questions!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘File – Cache Management’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [LiteSpeed Lisa](https://wordpress.org/support/users/lclarke/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/file-cache-management/#post-10667312)
 * Status: resolved