问题
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.
回答1:
In OpenCart there are 3 places that store cache
image cache is located at
public_html/image/cache
if you have vQmod
public_html/vqmod/vqcache
system (data) cache
public_html/system/cache
You can delete files within these folders - do not delete the cache
folders - only the content inside.
I hope this helps.
回答2:
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:
$this->cache->delete('product');
where 'product'
is the key defining which cache to delete. Other keys might be category
, language
, currency
, etc.
回答3:
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.
回答4:
You can also do it manually or by clearing cache folder files by php script.
If you are using other than 3.X version then the cache folder is in : System > storage > cache
If its a 3.X version then got to storage folder wherever you have moved that then inside that folder there is a cache folder.
Clear cache folder data & reload your store page. This solution worked for me. Thanks for asking this question.
来源:https://stackoverflow.com/questions/28539757/how-to-clear-cache-in-opencart-from-php