Generally, disk write caching is a feature or function that is meant to improve system performance. Write commands sent to data storage devices are collected and cached, until your hard disk or other storage device can be written to later on down the line. However, this is not always the case as file caching does not always improve performance.

This is especially true when it comes to OpenCart, where file caching can cause the platform to appear slow in some circumstances. You cannot stop OpenCart from writing cache files to disk either, usually in the site’s system/cache directory.

Not to worry though, there is a quick and easy fix around this. Simply use a tmpfs (memory based file system) for system/cache. Here is a simple method of doing this:

Method 1 – Overwrite the folder with a mount point.

mount -t tmpfs -o size=256m tmpfs /path/to/site/system/cache/

Lime Web Development Solution

All you have to do is mount a new tmpfs file system in that folder with this command. Easy as that! If you find that you cannot mount a new tmpfs file system for some reason, do not panic, as you might be in luck. Your system may already have one in place so check for the existence of /dev/shm.

Be aware if you are on a shared platform tough, other people may be able to see your cache files! Security is of the utmost importance, as you will see on our WordPress Security page.

Lime Web Development is a small and focused specialist web development agency based in Chorley, Lancashire. We primarily produce PHP web applications in WordPress, WooCommerce and CakePHP.

Changing OpenCart File Cache to Memory Cache