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

Manual cache file deletion? #35

Closed
Jakobud opened this issue Aug 20, 2013 · 6 comments
Closed

Manual cache file deletion? #35

Jakobud opened this issue Aug 20, 2013 · 6 comments
Assignees

Comments

@Jakobud
Copy link

Jakobud commented Aug 20, 2013

I just started messing around with this. Works great so far. I was wondering if it's possible to manually delete cache files when you are using filesystem storage as the caching type? I don't see where the cache files are stored on the file system.

There are some cases where I need to manually delete the cache and let my webpage rebuild the cache because a DB query was modified and I can't wait until the cache expires. Is the only way to delete the cache to call $cache->delete()?

@khoaofgod
Copy link
Member

You can use $cache->delete("keyword");
$cache->clean();

OR:

Delete folder cache.storage , this folder is store at current location of phpfastcache.php if you are using CGI , suPHP, and it store at tmp / upload folder of server if you are using DSO.

Read the document examples/2.setup.php , and you can setup custom path for this folder.

@ghost ghost assigned khoaofgod Aug 20, 2013
@Jakobud
Copy link
Author

Jakobud commented Aug 21, 2013

Ah okay thanks! The cache.storage folder is what I was looking for. Specifically I was wanting to manually delete the cache file/folder at the command line or via SFTP. Thanks

@Jakobud Jakobud closed this as completed Aug 21, 2013
@Jakobud
Copy link
Author

Jakobud commented Aug 23, 2013

Hmmm where is the cache.storage supposed to be? I don't see it at the same location as phpfastcache.php... My setup is:

require_once('phpfastcache/phpfastcache.php');
phpFastCache::setup('storage','auto');
$cache = phpFastCache();

Am I doing something wrong? Where else would the cache file be?

@Jakobud Jakobud reopened this Aug 23, 2013
@khoaofgod
Copy link
Member

if your php run as suPHP it will be in folder phpfastcache
if you're using DSO as PHP, it will be under /tmp or upload folder.

phpFastCache doesn't want to border you about CHMOD 0777 for that folder, so it automatic pick a right way with good security and have writeable for you.

If you want custom path for that folder, look at examples/2.setup.php <-- 🎯

You can do:
phpFastCache::setup("path", dirname(FILE));

@fajarfariyanton
Copy link

how to save all cache to one folder , and not create one folder to one cache

@khoaofgod
Copy link
Member

set the storage to "sqlite" , it will save to sqlite 1 - 2 files only.

Because Linux / Windows directory only allow around 30,000 files I think.

So, if you don't split them to multiple folder, the cache folder will dead after couple weeks, and also it's very diffucuti to clean up a folder have more than 10,000 files, slow and cost memory when reading everything from that folder. In real world, 1 folder contant all cache files is bad. Use "sqlite" / "memcached" / "memcache" if you don't want to deal with files.

I suggest sqlite

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