路径设置为/tmp/时如何清除phpFastCache [英] How to clear phpFastCache when path set to /tmp/

查看:45
本文介绍了路径设置为/tmp/时如何清除phpFastCache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在前端应用程序中使用phpFastCache,设置服务器"/tmp/"目录的路径:

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

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

我不想使用phpFastCache的自动找到的缓存目录,因为它会给用户访问应用程序的每个域(连接了几个域)的每个域都增加一个额外的目录,从而使我的主目录混乱.

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).

在后端,我想显示缓存统计信息并能够清除缓存.现在已经将/tmp/设置为缓存路径,这将不再起作用.统计信息显示为空,并且未清除缓存.我也确实在后端应用程序中将cache-directoy配置为相同的"/tmp/".

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.

如何配置phpFastCache以实现此目的?

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

推荐答案

查看phpFastCache代码后,我可以回答自己的问题:

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.

这将使phpFastCache使用/path-to-my-home-dir/phpfastcache作为其唯一的缓存目录.

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

如果我未设置'securityKey',则phpFastCache会从当前域中生成一个(在大多数情况下),因此我的后端应用程序只能看到"该部分缓存,该缓存位于当前使用的目录中域.

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.

这篇关于路径设置为/tmp/时如何清除phpFastCache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆