Dirk Seifert
Dirk Seifert

Reputation: 181

How to clear phpFastCache when path set to /tmp/

I'm using phpFastCache in a frontend-application, setting the path to the server's "/tmp/" directory:

phpFastCache::setup('path',"/tmp/");

I do not want to use phpFastCache's automatically found cache-directory, because it clutters my home directory with an extra directoy for every domain through which users are reaching the application (several are connected).

In the backend I would like to display cache-statistics and be able to clear the cache. This doesn't work anymore, now that I have set /tmp/ as the cache path. Statistics show up empty and the cache is not cleared. I did configure the cache-directoy to the same "/tmp/" in the backend-application as well.

How can phpFastCache be configured to be able to achieve this?

Upvotes: 2

Views: 2207

Answers (1)

Dirk Seifert
Dirk Seifert

Reputation: 181

After looking at the phpFastCache-code, I'm able to answer my own question:

To achieve what I wanted (have only ONE cache-directory, regardless of domain used; be able to list statistics and clear cache from a separate application) I had to make two config-settings:

phpFastCache::setup('path', '/path-to-my-home-dir');
phpFastCache::setup('securityKey', 'phpfastcache');

I'm setting these identically in both my frontend- and backend-applications.

This will make phpFastCache use /path-to-my-home-dir/phpfastcache as its only cache-directory.

Had I not set the 'securityKey', phpFastCache would have generated one from the current domain (in most cases), therefore my backend application would have only "seen" that part of the cache residing in the directory for the currently used domain.

Upvotes: 1

Related Questions