Menu Close
    Searching for an experienced Opencart Development Company ?

    Use cache in Opencart

    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.

    . . .
    Discuss on Helpdesk

    Leave a Comment

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


    Be the first to comment.

    Back to Top