osclass / Osclass

With Osclass, get your own classifieds site for free. Build your own Osclass installation and start advertising real estate, jobs or whatever you want- in minutes!
http://osclass.org/
647 stars 343 forks source link

Support for Litespeed Cache (LSCache) #2182

Open eurobank opened 7 years ago

eurobank commented 7 years ago

Most of scripts support this cache. It would be great if we can also have it for Osclass. Via a plugin or a simpler via .htaccess.

All the information is here (with examples):

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:no-plugin-setup-guidline

conejoninja commented 7 years ago

Never used litespeed before, but if I'm reading this correctly, is the cache only available in paid versions (LiteSpeed Enterprise Edition) of the webserver?

eurobank commented 7 years ago

I have no idea. A lot of hosting companies use LiteSpeed webserver for many reasons. So it came with my shared plan as a bonus.

Wordpress already has a plugin for it.

https://wordpress.org/plugins/litespeed-cache/

I read on their wiki "LSCache: LiteSpeed Cache, our extremely powerful page caching feature, is bundled free with 2-CPU or greater licenses. For all other licenses, LSCache can be bought as a separate module."

Some information:

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:no-plugin-setup-guidline

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:no-plugin-wordpress

eurobank commented 7 years ago

Also i tried to just make a .htaccess code for it (following the example) but had many problems that i don't know how to solve.

Login/Register for example doesn't seem to work. Some cookies code is needed, exclusions etc etc.

dev-101 commented 7 years ago

If it works like Varnish (from their docs), then Varnish doesn't work well with anything that has cookies, and Osclass depends on them.

conejoninja commented 7 years ago

Any caching on a logged user is complicated, as the page is unique to each user. "Non-logged" visits are easier, but if you are using cookies or session to store some sort of data (like default language, if you have accepted tracking cookies or not,...) then you might have a problem.

I'm more worried that litespeed looks like a paid server, it could come free with some hostings, but a) said hostings are probably paid too and b) I would highly appreciate if we could work/develop on a local environment instead of some external server

eurobank commented 7 years ago

@dev-101 Does Wordpress has cookies ? Because it works wonderfully with Wordpress. I ditched all other caching plugins.

Does this informatin helps your question:

"Our cache plugin will not trigger PHP. It is very similar to html page caches, except the benefit of LiteSpeed Cache is the server is aware of how the cached pages are stored.

IThe server stores the cache pages as static files and keeps a hash table with extra information about each stored page. The extra information allows us to purge pages more effectively as well as allows us to further improve the cache if needed."

Also if anyone wants to do ANY kind of test, i can offer a full account with ftp on a subdomain.

eurobank commented 7 years ago

@conejoninja maybe you should contact them directly. They are very helpful and friendly.

Maybe they could give you some license. I dunno. If i can help in anything, let me know. For now i will continue my attempts with .htaccess.

eurobank commented 7 years ago

@dev101

I see that plugins are available for Wordpress, Joomla, vBulletin, Mediawiki, IP Board, vbSeo. I find it hard to believe it will not work well with Osclass.

dev-101 commented 7 years ago

True, there are. But, personally, I have very little interest in it.

eurobank commented 7 years ago

How can i see if a user or admin is logged so i can disable caching ? I'm told to check cookies but i don't see any new cookie set when logged in.

conejoninja commented 7 years ago

osc_is_web_user_logged_in() and osc_is_admin_user_logged_in() might help here

eurobank commented 7 years ago

Thanks. I wasn't clear in my question. I must do all the work in .htaccess via mod_rewrite. Something like:

#To exclude users after login you will need to see if cookies are being set if so add the following and replace with the cookie that is being set
RewriteCond %{HTTP_COOKIE} !logged|cart [NC] 
conejoninja commented 7 years ago

https://github.com/osclass/Osclass/blob/master/oc-includes/osclass/helpers/hUsers.php#L66 oc_userId and oc_userSecret cookies should exists and be non empty

But cookies are only there for the "remember me" option. A logged user information resides on the session, not sure how you could access that from the .htaccess. Might be useful to look at the vbulletin plugin or something like that.

eurobank commented 7 years ago

It seems Vbulletin has cookies:

## select which pages to cache
RewriteCond %{HTTP_COOKIE} !bbimloggedin=yes
RewriteCond %{HTTP_COOKIE} !bbuserid=
RewriteCond %{HTTP_COOKIE} !bbpassword=
eurobank commented 7 years ago

I see how this works in this old cache plugin:

https://github.com/PluginCache-osclass/plugincache

I will try to find someone to "adapt" this plugin to work with Litespeed cache. It shouldn't be hard to do.

Tangol commented 7 years ago

I'm more worried that litespeed looks like a paid server, it could come free with some hostings, but a) said hostings are probably paid too and b) I would highly appreciate if we could work/develop on a local environment instead of some external server

@conejoninja Please note that LiteSpeed also has an open source version: http://open.litespeedtech.com/mediawiki/

eurobank commented 7 years ago

@Tangol Yes there is a free version of the web server but the LSCaching is bundled with the paid only. I think.

Tangol commented 7 years ago

@eurobank http://open.litespeedtech.com/mediawiki/index.php/Help:Modules:Cache (Caching Module is included in OpenLiteSpeed) Main Features

eurobank commented 7 years ago

@Tangol I don't think so. OpenLiteSpeed has a similar product. But not sure about it.

http://openlitespeed.com/threads/does-ols-includes-lscache.1882/

"OLS does not include LSCache. However, it does include the cache module, which functions very similarly."

Still i found this:

http://openlitespeed.com/threads/openlitespeed-now-supports-the-litespeed-cache-plugin-for-wordpress.2322/

"The new OpenLiteSpeed (re)release is now capable of using the LiteSpeed Cache Plugin for WordPress.

The LiteSpeed Cache Plugin for WordPress replaces any other caching solutions like WP Super Cache, W3 Total Cache, Hyper Cache, etc. and uses the OLS cache module to do the caching. Since the cache is served at the server level, any cached requests will never hit the WP backend, resulting in lightning fast PHP pages."

So maybe they are compatible with the commercial product.