Forums / General Questions / How do reduce cache folder size?

How do reduce cache folder size?

Locked

Started by kimsonvu on 27 Nov 2008, 7:55 PM · Views: 5,519

Results 1 to 18 of 18
This thread is locked. New replies are disabled.
27 Nov 2008, 7:55 PM
#1
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

How do reduce cache folder size?

HI ,

My website have a few GB each month with cache folder.

Any comment how to deduce them? At this time, my hosting account have 95 Gb data... :blink:

Thanks you !

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

28 Nov 2008, 4:01 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

What are the filenames in your cache folder?

Any files ending in .txt or .log can be removed.

If you have several "query_selects_*******.txt" files, you need to turn off Store Database Queries in Admin->Configuration->Logging

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

28 Nov 2008, 8:11 AM
#3
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

DrByte:

What are the filenames in your cache folder?

Any files ending in .txt or .log can be removed.

If you have several "query_selects_*******.txt" files, you need to turn off Store Database Queries in Admin->Configuration->Logging

Thanks you for your tip. I will do that. :clap:

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

30 Nov 2008, 10:17 AM
#4
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

Hi,

I have some question : When i turn off cache , will my website run slow down or anything will happen ?

Thanks you !

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

1 Dec 2008, 7:34 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

kimsonvu:

When i turn off cache , will my website run slow down or anything will happen ?
"turn off cache"?
What do you mean?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 7:45 AM
#6
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

DrByte:

"turn off cache"?
What do you mean?

Sorry i have misunderstand about cache. After check, i think i can't turn off them.

So, i must delete them by hand when folder cache is large , right ? Even i don't Store Page Parse Time and Store Database Queries.

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

1 Dec 2008, 7:55 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

What version of Zen Cart? What version(s) have you upgraded from?
What are all your settings in Admin->Configuration->Logging ?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 8:00 AM
#8
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

Please check my attached image about that .

Also, i use 1.38a

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

1 Dec 2008, 8:57 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

In /includes/classes/db/mysql/query_factory.php, do your lines 86-100 match the following code?```
function Execute($zf_sql, $zf_limit = false, $zf_cache = false, $zf_cachetime=0) {
// bof: collect database queries
[B] if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS=='true') {
[/B] global $PHP_SELF, $box_id, $current_page_base;
if (strtoupper(substr($zf_sql,0,6))=='SELECT' /&& strstr($zf_sql,'products_id')/) {
$f=@fopen(DIR_FS_SQL_CACHE.'/query_selects_' . $current_page_base . '_' . time() . '.txt','a');
if ($f) {
fwrite($f, "\n\n" . 'I AM HERE ' . $current_page_base . /zen_get_all_get_params() ./ "\n" . 'sidebox: ' . $box_id . "\n\n" . "Explain \n" . $zf_sql.";\n\n");
fclose($f);
}
unset($f);
}
}
// eof: collect products_id queries
global $zc_cache;

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 9:09 AM
#10
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

That code :

  function Execute($zf_sql, $zf_limit = false, $zf_cache = false, $zf_cachetime=0) {
    // bof: collect database queries
    if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS=='true') {
      global $PHP_SELF, $box_id, $current_page_base;
      if (strtoupper(substr($zf_sql,0,6))=='SELECT' /*&& strstr($zf_sql,'products_id')*/) {
        $f=@fopen(DIR_FS_SQL_CACHE.'/query_selects_' . $current_page_base . '_' . time() . '.txt','a');
        if ($f) {
          fwrite($f,  "\n\n" . 'I AM HERE ' . $current_page_base . /*zen_get_all_get_params() .*/ "\n" . 'sidebox: ' . $box_id . "\n\n" . "Explain \n" . $zf_sql.";\n\n");
          fclose($f);
        }
        unset($f);
      }
    }
    // eof: collect products_id queries
    global $zc_cache;

I think it is same!

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

1 Dec 2008, 9:14 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

If it's the same, then it should not be generating any query log files in your cache folder when you have "Store Database Queries" set to 'false'.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 9:19 AM
#12
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

Could you please tell me "Store Database Queries" use for ? When i turn off this option, i don't see any change ...

I don't know much more about this option and i still wonder about turn on or off :(

Thanks you for your help ! Mr. DrBye , you are nice person !

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

1 Dec 2008, 9:24 AM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

"Store Database Queries", when set to "true", causes the site to create files in the /cache/ folder which contain a list of all the database queries used to prepare the content of the page on every click to your website. These files are named "query_selects_xxxxxxxxxxx.txt".
Those query_selects_xxxxxx.txt files are intended ONLY for debugging serious database problems.

NORMALLY the "Store Database Queries" option should be set to "false", and therefore it will NOT generate any /cache/query_selects_xxxxxxx.txt files.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 9:25 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

You never answered this question:> DrByte:

What are the filenames in your cache folder?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 9:30 AM
#15
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

DrByte:

You never answered this question:

I don't have change to lock them ! My host said i was have 1 million files and i must delete them.

I was delete cache folder (i can't access to delete each file) and i was create new folder cache.

That is the way i fix when i don't know about this :smile:

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON

1 Dec 2008, 9:35 AM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

Do you have files in the /cache/ folder now?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 9:36 AM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do reduce cache folder size?

At the bottom of this page is a list of "Similar Threads", one of which refers to a simple utility to clear out all the old *.txt and *.log files from the /cache/ folder: http://www.zen-cart.com/forum/showthread.php?t=107669

You don't need it now since you deleted the entire folder, but it might be useful in the future if you run into the same problem again.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Dec 2008, 9:41 AM
#18
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Location:
HCMC
Posts:
263
Plugin Contributions:
0

Re: How do reduce cache folder size?

DrByte:

Do you have files in the /cache/ folder now?

Hi, after follow your guide : It look like only 1 file in cache folder now. I don't see many file any more...

The speed still good and don't slow down. It is great to use Zencart.

Thanks you again ! Mr. DrBye!!

From Hochiminh City - Vietnam !
Call me when you travel here : +840983038939
KIMSON