Latest Blog Posts

Editing the OpenCart Homepage
29.09.2025 2666 3 44 min

Editing the OpenCart homepage, customizing H1 and Title text, displaying products and modu..

How to Uninstall Powered by OpenCart
03.09.2025 4135 3 20 min

Remove Powered by OpenCart and customize footer: edit template, use theme editor or OCMOD ..

How to remove modules in OpenCart
28.08.2025 2114 3 12 min

Step-by-step instructions for deleting modules in OpenCart 3 via the admin panel, manually..

Which hosting to choose for OpenCart
25.08.2025 1436 3 19 min

Find out which hosting to choose for an OpenCart online store. Requirements, selection cri..

Setting up Memcached in OpenCart using hosting Ukraine as an example

1434 1 2 min
Setting up Memcached in OpenCart using hosting Ukraine as an example

Installing Memcache(d) in OpenCart will speed up your online store by reducing database load and improving site responsiveness. Below is a convenient step-by-step guide adapted for different OpenCart versions.

Main Features of Memcached in OpenCart

  • Support for various OpenCart versions:
    • OpenCart 3.0
    • OpenCart 2.2–2.3
    • OpenCart 2.0–2.1
    • OpenCart 1.5
  • Configuration settings:
    • CACHE_HOSTNAME — path to the socket, for example: /home/your_account/.system/memcache/socket
    • CACHE_PORT = 0 (used when connecting via UNIX socket)
    • CACHE_PREFIX or MEMCACHE_NAMESPACE — unique prefix for cached data
  • Involved files:
    • config.php, admin/config.php
    • system/config/default.php
    • index.php (in root and admin folder)
    • system/library/cache.php (in OpenCart 1.5)

Setup by OpenCart Versions

OpenCart 3.0

  1. Add to the end of config.php and admin/config.php files:
    define('CACHE_HOSTNAME', '/home/YOUR_ACCOUNT/.system/memcache/socket');
    define('CACHE_PORT', '0');
    define('CACHE_PREFIX', 'oc_');
  2. Open system/config/default.php and replace:
    $_['cache_engine'] = 'file';
    with:
    $_['cache_engine'] = 'memcached';

OpenCart 2.2–2.3

  1. Add to both config files:
    define('CACHE_HOSTNAME', 'unix:///home/YOUR_ACCOUNT/.system/memcache/socket');
    define('CACHE_PORT', '0');
    define('CACHE_PREFIX', 'oc_');
  2. In system/config/default.php replace:
    $_['cache_type'] = 'file';
    with:
    $_['cache_type'] = 'mem';

OpenCart 2.0–2.1

  1. Add to config.php and admin/config.php:
    define('CACHE_HOSTNAME', 'unix:///home/YOUR_ACCOUNT/.system/memcache/socket');
    define('CACHE_PORT', '0');
    define('CACHE_PREFIX', 'oc_');
  2. Open index.php (both root and admin) and replace:
    $cache = new Cache('file');
    with:
    $cache = new Cache('mem');

OpenCart 1.5

  1. Add to config.php:
    define('CACHE_DRIVER', 'memcached');
    define('MEMCACHE_HOSTNAME', 'unix:///home/YOUR_ACCOUNT/.system/memcache/socket');
    define('MEMCACHE_PORT', '0');
    define('MEMCACHE_NAMESPACE', 'opencart_test');
  2. Replace the entire code in system/library/cache.php with an updated implementation supporting memcached. (You can use your own version or a community solution)

Advantages of Using Memcached

  • Performance. Cache works directly from memory, speeding up OpenCart on all levels.
  • Reduced server load. Fewer database requests, especially with high traffic.
  • Easy setup. No deep technical knowledge needed, just edit configs and a few files.
  • Flexibility and scalability. Works reliably on small hosting and large projects alike.

Conclusion

Memcached is a simple and effective way to speed up OpenCart without extra coding. Setup takes minutes, but the effect is immediate: your site becomes noticeably faster and server load drops. This is especially important for SEO, user experience, and increasing sales. Set it up and see how your store starts to fly!

Products related to this post

Cache Cleaner module
699 грн.499 грн.
Clear modification cache, logs, images and system cache with one click from any page in the admin panel using AJAX...
Cart Cacher
Free
Cart Cacher is a small but very practical OCMOD module for OpenCart that caches calculated cart data at the cart library level. Th..
ChatGPT Consultant

Comments

Leave your comment or question
Благодарю. Смог подключить на опенкарт 3.

Write Comment

Popular