In front-end models, when fetching data from database, OpenCart looks for the cached data prior to querying the database. They are stored in plain text files using PHP's function serialize(). If system gets any cached data, they are fetched and unserialized and returned to the controller without querying the database.
Thus the fetching should be much quicker. If there are no cached data, then the database is queried and these data are then serialized using PHP's function serialize() and saved to the corresponding cache file.
Here is one small problem that may occur. After You have edited the data directly in the database, (using phpMyAdmin, may the reason be whatever for this) the change is not present at frontend. This is because, there are older data cached that are fetched when asked for them. If You have to do such editing, then do not forget to manually delete corresponding cache file(s).
The cache is instantiated and registered within index.php. it is then accessible in both controllers and models as $this->cache; while methods set(), get() and delete() are callable. The cache class itself could be found at system/library/cache.php and is quite simple and straight forward.
Now, in the administration (backend) part of models, when editing or adding data (category, product, currencies, weight classes, etc), after the data is successfully stored to the database the corresponding cache file is immediately deleted. So it could be re-created at frontend containing up-to-date data.
The cache files could be find at /system/cache/ folder.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
List of my works:
Technical Support:
If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.
Wordpress Plugins:
If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.
Wordpress Plugins:
- Real-Time Health Data from Every Where:WP plugin to display real-time health data & increase sale by promoting user specific products according to health information: garazlab.com.
- Woocommerce Stock Notification Builder:Sends desktop, mobile & email notifications with full customization.Build your own product notification system with it: garazlab.com.
Opencart Extensions:
- Product Based Quantity Wise Shipping: Find it here.
- OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
- Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
- Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
- Custom Field Product - add unlimited custom fields to the product form: Find it here.
- Formcaptcha - add captcha on the register page: Find it here.
1 comment:
Hi there Tahsin, I just read your most interesting post which made me wonder why commercial cache modules performs so much better than OpenCart's native mechanism. Has there been a major change or rollback of OpenCart functions between 2011 and 2014?
Post a Comment