Forums / General Questions / SQL_CACHE_METHOD What is it?

SQL_CACHE_METHOD What is it?

Results 1 to 9 of 9
24 Jan 2013, 14:16
#1
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Posts:
968
Plugin Contributions:
0

SQL_CACHE_METHOD What is it?

SQL_CACHE_METHOD What is it?

If set to database or file, what exactly is it and what is the reason for using it?

Are there disadvantages to using it?

I have searhed about and seen explainations on how to set it and that one goes to the database and one goes to the file but not what it is actually used for, its purpose?

Noob question but can someone please explain for me in full as I have never used it.

Cheers
24 Jan 2013, 16:43
#2
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Posts:
1,818
Plugin Contributions:
2

Re: SQL_CACHE_METHOD What is it?

philip937:

SQL_CACHE_METHOD What is it? ... If set to database or file, what exactly is it and what is the reason for using it? ... Are there disadvantages to using it?

There is a fairly straightforward answer in configure.php file contents explained.

philip937:

I have searhed about and seen explainations on how to set it and that one goes to the database and one goes to the file but not what it is actually used for, its purpose?

A quick web search on the word "cache" provides a number of explanations for what a cache is and why you might use one. Here is one such article from Microsoft.
25 Jan 2013, 11:10
#3
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Posts:
968
Plugin Contributions:
0

Re: SQL_CACHE_METHOD What is it?

lhungil:

There is a fairly straightforward answer in configure.php file contents explained.


A quick web search on the word "cache" provides a number of explanations for what a cache is and why you might use one. Here is one such article from Microsoft.


I already read that configure.php contents page, its doesnt answer my question.

I know what Cache is, and what it is used for, however I want to know what is being cahed to the db or file of the setting in the configure.php file is set.set and for what purpose/benefits/disadvantages.
25 Jan 2013, 11:17
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: SQL_CACHE_METHOD What is it?

Some SQL queries for your store may be cached for ... well, for the reasons you said you already understand.

Setting it to 'none' effectively disables the caching.
Setting it to 'file' is ... well ... obsolete since v1.5.0.
Setting it to 'database' causes the preprocessed sql query results to be stored so a single lookup will retrieve the data instead of having to make the database go out and collect all the info for some complex queries again. This gives some performance gain.
While it may seem odd to cache database results to the database, the purpose is mainly for minimizing delays with complex lookups or very high-traffic lookups. But, that's what caching is all about, as you know.

If your server is very well tuned, then you might get a small increase in performance by enabling the caching (as I said earlier, the only valid option is 'none' or 'database').
If your server is already struggling to perform well at the database level, caching to database will not be beneficial and you should really look at improving your server configuration.
25 Jan 2013, 11:37
#5
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Posts:
968
Plugin Contributions:
0

Re: SQL_CACHE_METHOD What is it?

Thanks Doc.

is it any queries that are cahed or only ZenCart core file queries. i.e would queires carried out my mods be included?

Also can caching cause issues? is it only caching the look up statements or does it cache the results? if changes are made to the catalougue would cache need to be reset to ensure current results are shown etc?
25 Jan 2013, 11:48
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: SQL_CACHE_METHOD What is it?

It only caches a select few core queries. Not addons.
And only reads, not writes.
And the system already does any cache cleanup needed whenever any cached data is changed, so integrity is always preserved.

If your question is still about performance, the addition of the query_cache code in 1.5.1 almost invalidates the need for the older legacy caching. I would venture to say that you would find little gain by enabling SQL_CACHE_METHOD if query_cache is enabled.

And, as I said earlier, if your server's database is sluggish at all, then that's what you should be tuning, not the caching settings in Zen Cart.
25 Jan 2013, 13:19
#7
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Posts:
968
Plugin Contributions:
0

Re: SQL_CACHE_METHOD What is it?

I dont have any problems and have never needed to enable it.. Just edjamucating myself :p
25 Jan 2013, 13:23
#8
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Posts:
968
Plugin Contributions:
0

Re: SQL_CACHE_METHOD What is it?

Although I did once bring this up before, the only time I ever had a problem is when someone was purposly adding hundreds if not thousends of products in the cart. this seem to create exponetial queries on the database on every page load the more products that were in the cart to the point of the site no longer responding. I guess the only way to tackle that is to put a limit on the max server queries per user?
04 Dec 2013, 16:57
#9
dianne avatar

dianne

Zen Follower

Join Date:
May 2007
Posts:
102
Plugin Contributions:
0

Re: SQL_CACHE_METHOD What is it?

DrByte:

If your server is already struggling to perform well at the database level, caching to database will not be beneficial and you should really look at improving your server configuration.


Can you give an example of how you would know if the server was struggling to perform well at the database level? I'm not a programmer so I don't know what to look for or what I would be seeing/experiencing.

Also, what steps would I take - or what should I be asking my host company - to improve the server configuration?

BTW, the store that lead to this question is using zen cart v1.3.9h and the owner does not want to upgrade. The site is hosted with Hostgator.

I would like to take these actions if I could get more clarity on exactly what to do.

Thanks for anything you can share.