• Resolved Nathaniel Meyer

    (@beansandrice)


    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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support LiteSpeed Lisa

    (@lclarke)

    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⚡

    (@hailite)

    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

    (@beansandrice)

    @lclarke
    They don’t update until they visit a page that hasn’t been viewed yet.

    @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

    (@lclarke)

    Hi, @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 recently. And this wiki 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.