I'm using oc 3.0.3.8 and its a fresh install on a Litespeed server. The language and time zone is turkish.
I tried to use redis for caching, everything looks fine but bestseller and latest on homepage.
I want to explain everything first. Third party extensions works well on homepage, every product updates any changes like enable/disable products, stock status (even when someone buy it) etc.
But on bestseller and latest extensions, they does not update anything till the cache expire time. For example, i disable a product and it still showing on homepage/latest products like enabled.
Is this a general issue or just me?
Thanks in advance to anybody want to help.
Cache control headers viewtopic.php?t=214597
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
so you mean its about browser caching?by mona wrote: ↑Wed Nov 23, 2022 3:52 pmwhat is caching https://nitropack.io/blog/post/web-cach ... ners-guide
Cache control headers viewtopic.php?t=214597
when i try with new secret chrome tab its same.
or when i turn redis to file cache its ok.
the reason is to reduce the time it takes to get a webpage
the purpose is for you to speed up your site
the downside is it does not update
purge the cache after you have made an edit?
whether that be litespeed or anything else
I appreciate english is not your first language I am sure there are many blogs on the subject in turkish
I was just trying to get you to understand what it is your are installing - I am a advocate of doing everything else first.
Why do you need it ? If there is a reason you need it fix that.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Thank you for help.by mona wrote: ↑Wed Nov 23, 2022 5:32 pmCaching is in its basic form use an old file rather than a new one
the reason is to reduce the time it takes to get a webpage
the purpose is for you to speed up your site
the downside is it does not update
purge the cache after you have made an edit?
whether that be litespeed or anything else
I appreciate english is not your first language I am sure there are many blogs on the subject in turkish
I was just trying to get you to understand what it is your are installing - I am a advocate of doing everything else first.
Why do you need it ? If there is a reason you need it fix that.
When the cache option is set to "file", everything works well as it should be.
My case is happening when i set it up to redis or memcached.
Both on redis or memcached, when someone buy a product which is 1 piece in stock, the latest or bestseller extensions is not updated on homepage. The product page is updated and shows no stock, search page, cateogry pages, everything is fine but these two extensions.
I've got the same result on different scenarios like i disable a product which is listing on bestseller. It's still showing up on bestseller but disabled on the other homepage extensions as normal.
I hope i can explained it correctly.
In the other hand, there's no information about this on turkish blogs or any other sources.
https://github.com/opencart/opencart/bl ... /redis.php
Redis del won't accept patterns so deleting 'products' won't remove 'product.latest...'.
You will need to stick with file cache, raise the issue on GitHub or get a developer to fix it.
Thank you so much. I don't face this issue on only redis. Its same with memcached and litespeed cache extention.ADD Creative wrote: ↑Wed Nov 23, 2022 6:57 pmLooking at the code I can't see that the Redis cache ever worked correctly.
https://github.com/opencart/opencart/bl ... /redis.php
Redis del won't accept patterns so deleting 'products' won't remove 'product.latest...'.
You will need to stick with file cache, raise the issue on GitHub or get a developer to fix it.
I have researched it on every possible source on internet but can not see anything related. Am i the first complainer about this?
I just wonder that is it stable and fast enough for too many visitors on a starter pack server from digitalocean if i switch it to the file cache?
Is it possible to face some overconsumption on server in future?
Thank you in advance.
but is it elimate caching?
Code: Select all
public function getBestSellerProducts($limit) {
$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit);
if (!$product_data) {
$product_data = array();
$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);
foreach ($query->rows as $result) {
$product_data[$result['product_id']] = $this->getProduct($result['product_id']);
}
$this->cache->set('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit, $product_data);
}
return $product_data;
}
Code: Select all
public function getBestSellerProducts($limit) {
$product_data = array();
$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit);
foreach ($query->rows as $result) {
$product_data[$result['product_id']] = $this->getProduct($result['product_id']);
}
return $product_data;
}
-- Phil Karlton
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Yes, removing the cache get and set will remove the caching.
i have opened up a github issue and the chairman closed it without any answer
i dont understand what i did wrong, i just need to fix it
You will probably have to stick with file cache and if you think it's causing a problem pay a developer to fix one of the others.
Not sure where these analysis are taken from, but one thing's for sure is that I don't see any pull requests in the opencart-3 repository in regard of cache issues especially since the OP user is using OC v3.x releases.ADD Creative wrote: ↑Fri Nov 25, 2022 5:55 pmSadly this happens all the time with OpenCart. Real issues get closed for no reason and all manner of rubbish get merged.
You will probably have to stick with file cache and if you think it's causing a problem pay a developer to fix one of the others.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Code: Select all
public function delete($key) {
$this->cache->del(CACHE_PREFIX . $key);
}
Code: Select all
public function delete($key) {
$this->cache->del($this->cache->keys(CACHE_PREFIX . $key.'*');
}
Be aware that using the keys() method has implications performance-wise.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Users browsing this forum: No registered users and 324 guests