06/25/2008 by retry
So my friend runs a biz with osC, and he was having major troubles with adding/modifying products. The sql updated, but the browser timed out before finishing the post. Upon investigation we isolated it down to the tep_reset_cache_block() function trying to clear cache files from the cache dir. The cache dir, /tmp/, was filled up with 40,000+ files, so the way tep_reset_cache_block() was iterating through the dir was far too slow and stupid. I have fixed this. He also didn't like that the entire also_purchased cache was removed and not just the cache files pertaining to the product being altered. I fixed this as well.
This new version of tep_reset_cache_block(), uses glob instead of readdir. It's much much faster and also it makes sure there is a properly set pid for the also_purchased cache. This is something of a hack/kludge. I am not familiar enough with the osC codebase to fix the root problem -- merely correct the symptom in the least obtrusive way I could.
This mod should be useful to anyone running a large osC installation and gets a lot of hits and a lot of sessions cached to disk. AFAIK, there are no downsides to this script, but I'm not guaranteeing odd behavior. It certainly shouldn't hose your site.
Fix on Pid
06/25/2008 by Phocea
Almso the same as below but removed the logic to only delete also_purchase_products using the pid.
Good idea but if you delete or disable a product, the reset cache block would only delete cache for this product ID and not for all other product that might be linked to it.
Instruction included in the file, only one function to replace.
A better tep_reset_cache_block
04/29/2007 by retry
So my friend runs a biz with osC, and he was having major troubles with adding/modifying products. The sql updated, but the browser timed out before finishing the post. Upon investigation we isolated it down to the tep_reset_cache_block() function trying to clear cache files from the cache dir. The cache dir, /tmp/, was filled up with 40,000+ files, so the way tep_reset_cache_block() was iterating through the dir was far too slow and stupid. I have fixed this. He also didn't like that the entire also_purchased cache was removed and not just the cache files pertaining to the product being altered. I fixed this as well.
This new version of tep_reset_cache_block(), uses glob instead of readdir. It's much much faster and also it makes sure there is a properly set pid for the also_purchased cache. This is something of a hack/kludge. I am not familiar enough with the osC codebase to fix the root problem -- merely correct the symptom in the least obtrusive way I could.
This mod should be useful to anyone running a large osC installation and gets a lot of hits and a lot of sessions cached to disk. AFAIK, there are no downsides to this script, but I'm not guaranteeing odd behavior. It certainly shouldn't hose your site.
As experienced osCommerce Experts, we are glad to help you to install this addon. The process is as follow:
- You placed an order of this addon or other addons, checkout and receive an email notification of order status
- Or you can contact us directly using email form, asking us to install this addon for you
- Once you and we have agreed to start, please send us FTP access by email
- You will be updated of the installation status
- You may ask for customization jobs of this addon
You Risk Nothing: No Upfront Payment Required
Our
NO RISK POLICY is clear. You pay only for the successful completion of the installation. If you are not satisfied or we are unsuccessful, your site will be returned to its previous working state and
you pay nothing! NOT A PENNY!
Once you are satisfied with our help, you can pay us through Paypal.