Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the entry PHP script is modified, the cache is cleared. #406

Open
ziaratban opened this issue Jul 29, 2024 · 11 comments
Open

When the entry PHP script is modified, the cache is cleared. #406

ziaratban opened this issue Jul 29, 2024 · 11 comments

Comments

@ziaratban
Copy link

I rewrite all non-files or directories in "index.php" and cache some requests based on conditions , so when the content of the index.php file is updated, all the cache is cleared.

@litespeedtech
Copy link
Owner

should the cache be cleared or not? what's the current behavior?

@ziaratban
Copy link
Author

should the cache be cleared or not?

It should not be cleared.

what's the current behavior?

cleared.

@AndreyPopovNew
Copy link

@ziaratban you again about opcache?

check opcache settings
https://www.php.net/manual/en/opcache.configuration.php

opcache.validate_timestamps
opcache.revalidate_freq

@ziaratban
Copy link
Author

@AndreyPopovNew thanks for reply.

I am talking about the internal module cache in lsws.
opcache is disabled.

@ziaratban
Copy link
Author

should the cache be cleared or not? what's the current behavior?

Module Parameters :

checkPrivateCache   1
checkPublicCache    1
maxCacheObjSize     10000000
maxStaleAge         200
qsCache             1
reqCookieCache      1
respCookieCache     1
ignoreReqCacheCtrl  1
ignoreRespCacheCtrl 0

enableCache         1
expireInSeconds     3600
enablePrivateCache  0
privateExpireInSeconds 3600

@AndreyPopovNew
Copy link

@ziaratban
are you about lscache?

by your settings lscache expired after 3600 seconds (1 hour)

lscache store cached pages (even dynamically generated) as static HTML files

by default, if you change any page (code of page) then lscache purge cached page and not create new cached page until next page request.

depending from settings lscache can purge:

  • only changed page
  • changed page and only category to what changed page belong
  • changed page, category to what changed page belong and all pages in this category
  • changed page, category to what changed page belong, all pages in this category and all upper categories
  • purge all cache

@ziaratban
Copy link
Author

if you change any page (code of page)

This is exactly the problem, it doesn't make sense for dynamic pages.
The worst case is that I cannot update the source of my program on the server. If the program source is updated, my dynamic pages will also be removed from the cache.

I think this needs to be handled by settings or headers.

@AndreyPopovNew
Copy link

This is exactly the problem, it doesn't make sense for dynamic pages.

exist ESI - https://www.litespeedtech.com/products/features/edge-side-includes
but OpenLiteSpeed (OLS) not support this.
only LiteSpeed Web Server (LSWS)

@ziaratban
Copy link
Author

Thank you for your solution.
I still think this feature is one of the essential issues in lscache.
Otherwise, the use of lscache in external applications is incomplete. (for example in lsphp)

@litespeedtech what is your opinion?

@litespeedtech
Copy link
Owner

I am not sure why a staled cached page is preferred over updated page reflecting the most recent change.
I think most people want to see the change immediately.
It has nothing to do with ESI.
If you do not want to get slow loading page after update the code, then configure a crawler to warm-up the cache immediately.

@ziaratban
Copy link
Author

As you are aware, in php frameworks and especially in the world of object orientation, compared to the traditional mode (such as WordPress), everything starts from an index.php file or entry script so that the entire system flow is controlled by the framework (such as yii2 or Laravel). Therefore, all requests go to one file, and therefore cache control must be managed in one file and in the framework layers. If openlitespeed is supposed to delete the entire cache by updating the index.php file, it is not logical.
Apart from this rule, the world of external apps is a dynamic world, this dictates that we leave the control of the cache completely at the disposal of external apps.

This current behavior of cache module in openlitespeed is responsive for static files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants