如何从 PHP 清除 Opencart 中的缓存
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28539757/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to clear cache in Opencart from PHP
提问by Brian
I need to clear cache on certain condition from PHP code. How can I do so. I know that there is object Cache exists in opencart engine, but how do delete cache correctly.
Or it is possible to delete just folders ?
Please give advice.
我需要在特定条件下从 PHP 代码中清除缓存。我怎么能这样做。我知道 opencart 引擎中存在对象缓存,但是如何正确删除缓存。
或者可以只删除文件夹?
请给点建议。
回答by Brian
In OpenCart there are 3 places that store cache
在 OpenCart 中,有 3 个地方可以存储缓存
image cache is located at
public_html/image/cache
if you have vQmod
public_html/vqmod/vqcache
system (data) cache
public_html/system/cache
图像缓存位于
public_html/image/cache
如果你有 vQmod
public_html/vqmod/vqcache
系统(数据)缓存
public_html/system/cache
You can delete files within these folders - do not delete the cache
folders - only the content inside.
您可以删除这些文件夹中的文件——不要删除cache
文件夹——只删除里面的内容。
I hope this helps.
我希望这有帮助。
回答by shadyyx
What you need to do is to take a look at some models in admin
folder and check some add/delete methods, i.e. in admin/model/catalog/product.php
the addProduct()
method calls:
你需要做的是看看在某些型号admin
的文件夹,并检查了一些添加/删除方法,即在admin/model/catalog/product.php
该addProduct()
方法调用:
$this->cache->delete('product');
where 'product'
is the key defining which cacheto delete. Other keys might be category
, language
, currency
, etc.
'product'
定义要删除哪个缓存的键在哪里。其他键可能是category
,language
,currency
,等。
回答by Y. Joy Ch. Singha
It works to me-
Go to:
Step 1.
In admin dashboard click in Dashboard
and you will get gearing icon
in top right side and click on it. You get see Developer Settings
. And you get find Cache
and Action
. So, in Cache click on Off
and Click Refresh Icon
in Action.
Step 2.
Admin > Extensions > Modifications >
click on the Refresh Icon
that you will see in top right side and check again.
它对我有用 - 转到:第 1 步。在管理仪表板中单击Dashboard
,您将进入gearing icon
右上角并单击它。你看Developer Settings
。你得到 findCache
和Action
。因此,在缓存中单击Off
并单击Refresh Icon
操作。步骤 2.
Admin > Extensions > Modifications >
单击Refresh Icon
您将在右上角看到的 并再次检查。