如何从 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/cacheif you have vQmod
public_html/vqmod/vqcachesystem (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 cachefolders - 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 adminfolder and check some add/delete methods, i.e. in admin/model/catalog/product.phpthe 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 Dashboardand you will get gearing iconin top right side and click on it. You get see Developer Settings. And you get find Cacheand Action. So, in Cache click on Offand Click Refresh Iconin Action.
Step 2.
Admin > Extensions > Modifications >click on the Refresh Iconthat 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您将在右上角看到的 并再次检查。

