Reading list Switch to dark mode

    Use cache in Opencart

    Updated 15 July 2016

    As Opencart provides the cache library (cache.php), so here we will learn how to perform caching in Opencart. Opencart uses file cache by default and it provides files for performing 3 types of caching viz. APC(Alternative PHP Cache), file(file cache) and mem(memory cache). The cache data saved in the file is in the JSON format.

    You can use any type of caching among the above three by just changing the value of $_[‘cache_type’] to ‘file’, ‘apc’ or ‘mem’ in system->config->default.php.

    For creating cache, we have to use the following code:

    $this->cache->set('cacheName', $cacheData);

    Here, ‘cacheName’ is the name by which cache can be called and $cacheData is a variable in which the data is stored. In order to get the stored data, the following command will be used.

    $this->cache->get('cacheName');

    So, it’s very easy to use the cache. By default, Opencart mainly uses cache for currency and language. You can try it with different types too.

    Searching for an experienced
    Opencart Company ?
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home