Zen Cart Logo
Forums / Basic Configuration / Disk Usage limit: What is the cache forlder for?

Disk Usage limit: What is the cache forlder for?

Locked

Views: 8,535

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
24 Dec 2007, 1:09 PM
#1
shocker avatar

shocker

Zen Follower

Join Date:
Jul 2007
Location:
Jakarta
Posts:
346
Plugin Contributions:
0

Disk Usage limit: What is the cache forlder for?

I have check my disk usage in cpanel and it tells me that I'm at 95%

My hosting provider says that my cache folder appears to be the culprit.

How is the cache folder ...\zen-cart\cache managed?
What is this folder for?
Is it necessary?
Can I clear its contents without ill effects?

24 Dec 2007, 4:22 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Disk Usage limit: What is the cache forlder for?

You can clear it out, except for 2 files: .htaccess and index.php
Leave those 2 files, since they are safeties to protect against snoopers who might try to poke around in the files in that folder.

The cache folder is mainly used to store database cache queries and also to store customer session data, depending on how your site is configured. Periodic cleanup is a good idea.

24 Dec 2007, 10:29 PM
#3
shocker avatar

shocker

Zen Follower

Join Date:
Jul 2007
Location:
Jakarta
Posts:
346
Plugin Contributions:
0

Re: Disk Usage limit: What is the cache forlder for?

Thanks Dr. Byte

Is the best way to clear this up via a file manager type program and just delete, or is there a tool on the Admin menu?

"depending on how your site is configured"
How do I understand the setting and how do I configure them?

thanks

Nahid Fashions

25 Dec 2007, 7:58 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Disk Usage limit: What is the cache forlder for?

shocker:

Is the best way to clear this up via a file manager type program and just delete, or is there a tool on the Admin menu?File Manager or FTP program ... and choose "delete".
There is no admin-provided tool for doing this.

shocker:

"depending on how your site is configured"
How do I understand the setting and how do I configure them?You're probably doing file-based caching ... and probably doing it "for a reason". Thus, I don't recommend making any changes.
The settings for whether to use file or database-based caching and what folder to do it in are contained in your configure.php files.
I recommend not changing those settings without specific reason.

25 Dec 2007, 12:22 PM
#5
shocker avatar

shocker

Zen Follower

Join Date:
Jul 2007
Location:
Jakarta
Posts:
346
Plugin Contributions:
0

Re: Disk Usage limit: What is the cache forlder for?

I'd like to pretend I'm smart enough to know the "reason" to your file-based caching, but I'm not.
But I take it that this something I don't have to worry about. Just clear the files from time-to-time.

thanks again

25 Dec 2007, 4:16 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Disk Usage limit: What is the cache forlder for?

What is history of your Zen Cart site?
ie: what version did you first install?
Who installed it?
Who performed upgrades on it?
What is your Version History on the Admin->Tools->Server Info page?

26 Dec 2007, 2:28 AM
#7
shocker avatar

shocker

Zen Follower

Join Date:
Jul 2007
Location:
Jakarta
Posts:
346
Plugin Contributions:
0

Re: Disk Usage limit: What is the cache forlder for?

Zen Cart 1.3.7
Database Patch Level: 1.3.7
v1.3.7 [2007-06-24 12:39:52] (Fresh Installation)

I installed this and have performed some upgrades (user mods).

That's it, quite basic

26 Dec 2007, 5:25 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Disk Usage limit: What is the cache forlder for?

Okay, by default, the cache setting is set to "database".
I'm not sure why you selected "file" instead when you did the installation.
It's usually best to use "database"-based caching etc

In your configure.php file, you have two entries affecting this.
MAKE A BACKUP OF YOUR 2 CONFIGURE.PHP FILES BEFORE CHANGING ANYTHING.

Since you're the site owner, and you did the install, and thus it was you who changed the setting in the first place, you could try changing them as shown below in order to switch to database-based storage:

  define('STORE_SESSIONS', 'db');
  define('SQL_CACHE_METHOD', 'database'); 
```Beware that if your database is on an overloaded shared-hosting server, this might slow down your site somewhat.  If this happens, put the settings back to what you had earlier.

Be sure to change BOTH configure.php files if you're going to do these changes.
26 Dec 2007, 11:59 AM
#9
shocker avatar

shocker

Zen Follower

Join Date:
Jul 2007
Location:
Jakarta
Posts:
346
Plugin Contributions:
0

Re: Disk Usage limit: What is the cache forlder for?

both configure.php files:

includes\configure.php
admin\includes\configure.php

already had the following settings

  define('STORE_SESSIONS', 'db'); // use 'db' for best support, or '' for file-based storage

  // The next 2 "defines" are for SQL cache support.
  // For SQL_CACHE_METHOD, you can select from:  none, database, or file
  // If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache
  // or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder
  // ie: /path/to/your/webspace/public_html/zen/cache   -- leave no trailing slash
  define('SQL_CACHE_METHOD', 'database');
26 Dec 2007, 4:43 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Disk Usage limit: What is the cache forlder for?

hmmm

what kind of filenames were you seeing in your cache folder then?

27 Dec 2007, 6:28 AM
#11
shocker avatar

shocker

Zen Follower

Join Date:
Jul 2007
Location:
Jakarta
Posts:
346
Plugin Contributions:
0

Re: Disk Usage limit: What is the cache forlder for?

the file listing looks something like this:

query_selects_shippinginfo_1198650621.txt
query_selects_product_info_1198713995.txt
query_selects_products_new_1198707130.txt
query_selects_products_all_1198713625.txt

Just a note (this is from my hosting provider:

I believe the reason you were unable to remove the cache/ directory via FTP previously is because of the LimitRecursion setting on our shared servers. LimitRecursion is the setting that specifies how many files can be listed via FTP. This was previously set to 2000. There are over 170,000 files in the cache/ directory which may have been causing the issue.

27 Dec 2007, 6:53 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Disk Usage limit: What is the cache forlder for?

Oh. Clearly I should have asked that question much sooner.

Turn off query logging: Admin->Configuration->Logging->Store Database Queries
That should only be used for debugging specific database issues.
... otherwise it uses a huge amount of disk space, and slows down performance of your site.

27 Dec 2007, 9:22 AM
#13
shocker avatar

shocker

Zen Follower

Join Date:
Jul 2007
Location:
Jakarta
Posts:
346
Plugin Contributions:
0

Re: Disk Usage limit: What is the cache forlder for?

Ok, thanks.
I had not need to have that on. Maybe it's something I changed as I was getting up to speed on ZenCart.

Thanks for you help.

ZenCart Rocks!

25 Mar 2008, 6:46 PM
#14
capnhairdo avatar

capnhairdo

New Zenner

Join Date:
Jan 2008
Posts:
38
Plugin Contributions:
1

Re: Disk Usage limit: What is the cache forlder for?

Just had a similar experience where my cache folder was reaching 3 GBs after just a few days and my web host nearly had an aneurysm.

DrByte:

by default, the cache setting is set to "database". I'm not sure why you selected "file" instead when you did the installation. It's usually best to use "database".
...in order to switch to database-based storage:

define('STORE_SESSIONS', 'db');
define('SQL_CACHE_METHOD', 'database');


I'm confused...what's the object of caching at all if it SLOWS DOWN the site? I would have thought caching should have sped it up.

I changed mine to file-based during installation because I assumed (apparently in error) that it was faster & better than db caching, but that db-based was the default since it was easier to set up.

So should I just turn off caching entirely? What's the advantage of having it on—is there any performance gain, or is it just useful for debugging? (I wish there was...see [\*\*Death by 1000 queries\*\*](http://www.zen-cart.com/forum/showthread.php?t=83340).) And what's the difference between the two forms of caching mentioned above (the one set in the config files and the other set in the admin), if any? If none, why do you have to change it in two different places?