{"id":92730,"date":"2017-08-11T10:44:24","date_gmt":"2017-08-11T10:44:24","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=92730"},"modified":"2017-08-24T14:36:25","modified_gmt":"2017-08-24T14:36:25","slug":"using-redis-cache-opencart","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/","title":{"rendered":"Using Redis Cache In Opencart"},"content":{"rendered":"<p>Nowadays, caching has become a hot topic of discussion as everyone wants to maintain their website&#8217;s speed even on handling millions of users at a time. Opencart is using caching since its initial days like used file cache in version 1.5, then added\u00a0APC (Alternative PHP Cache) and Memcache\u00a0in version 2 and now in version 3 added Redis\u00a0library.<\/p>\n<p><strong>Redis Introduction<\/strong><\/p>\n<p>Redis has its own advantages. According to its website, Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.<\/p>\n<p>Redis is an in-memory data structure server. You can add any values to Redis cache like integers, string etc.<\/p>\n<p><strong>How to use Redis with Opencart?<\/strong><\/p>\n<p>In order to use Redis with Opencart, you have to first\u00a0install Redis to your server. Here is the <a href=\"https:\/\/redis.io\/download\" target=\"_blank\" rel=\"noopener noreferrer\">Download Link<\/a>.<\/p>\n<p>Then you have to install <a href=\"https:\/\/github.com\/phpredis\/phpredis\" target=\"_blank\" rel=\"noopener noreferrer\">phpredis<\/a>\u00a0to your server.<\/p>\n<p>You can check Redis in\u00a0phpinfo().<\/p>\n<p><em><img decoding=\"async\" class=\"alignleft size-full wp-image-92746\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/08\/Screenshot_5-2.png\" alt=\"\" width=\"1014\" height=\"159\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/08\/Screenshot_5-2.png 1014w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/08\/Screenshot_5-2-250x39.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/08\/Screenshot_5-2-300x47.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/08\/Screenshot_5-2-768x120.png 768w\" sizes=\"(max-width: 1014px) 100vw, 1014px\" loading=\"lazy\" \/><\/em><br \/>\nNow, you have to make some changes to your opencart system. You have to edit\u00a0<strong>system-&gt;config-&gt;default.php\u00a0<\/strong>and\u00a0change the value of $_[&#8216;cache_type&#8217;].<\/p>\n<pre class=\"brush:php\">$_['cache_engine']         = 'redis';<\/pre>\n<p>You also need to define a few constants. Either you can make changes in both <strong>config.php<\/strong> and <strong>admin-&gt;config.php<\/strong> or you can perform change either in <strong>system-&gt;startup.php<\/strong> or <strong>system-&gt;framework.php<\/strong> (before cache object in this case). You have to define following constants.<\/p>\n<pre class=\"brush:php\">define('CACHE_HOSTNAME', '127.0.0.1');\r\ndefine('CACHE_PORT', '6379');\r\ndefine('CACHE_PREFIX', 'redis_');<\/pre>\n<p>Now, you are complete with the changes in Opencart and you can\u00a0make use of Redis\u00a0on your website.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nowadays, caching has become a hot topic of discussion as everyone wants to maintain their website&#8217;s speed even on handling millions of users at a time. Opencart is using caching since its initial days like used file cache in version 1.5, then added\u00a0APC (Alternative PHP Cache) and Memcache\u00a0in version 2 and now in version 3 <a href=\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":70,"featured_media":84482,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[305,13],"tags":[1317,2071,5281,1316,5282],"class_list":["post-92730","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-opencart","category-php","tag-cache","tag-opencart","tag-phpredis","tag-redis","tag-redis-cache"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Redis Cache In Opencart - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Redis Cache In Opencart - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Nowadays, caching has become a hot topic of discussion as everyone wants to maintain their website&#8217;s speed even on handling millions of users at a time. Opencart is using caching since its initial days like used file cache in version 1.5, then added\u00a0APC (Alternative PHP Cache) and Memcache\u00a0in version 2 and now in version 3 [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-11T10:44:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-08-24T14:36:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vikhyat Sharma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vikhyat Sharma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\"},\"author\":{\"name\":\"Vikhyat Sharma\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0\"},\"headline\":\"Using Redis Cache In Opencart\",\"datePublished\":\"2017-08-11T10:44:24+00:00\",\"dateModified\":\"2017-08-24T14:36:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\"},\"wordCount\":301,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"keywords\":[\"cache\",\"opencart\",\"phpredis\",\"redis\",\"redis cache\"],\"articleSection\":[\"opencart\",\"php\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\",\"url\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\",\"name\":\"Using Redis Cache In Opencart - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"datePublished\":\"2017-08-11T10:44:24+00:00\",\"dateModified\":\"2017-08-24T14:36:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"width\":\"825\",\"height\":\"260\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Redis Cache In Opencart\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0\",\"name\":\"Vikhyat Sharma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Vikhyat Sharma\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/vikhyat-sharma83\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Redis Cache In Opencart - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/","og_locale":"en_US","og_type":"article","og_title":"Using Redis Cache In Opencart - Webkul Blog","og_description":"Nowadays, caching has become a hot topic of discussion as everyone wants to maintain their website&#8217;s speed even on handling millions of users at a time. Opencart is using caching since its initial days like used file cache in version 1.5, then added\u00a0APC (Alternative PHP Cache) and Memcache\u00a0in version 2 and now in version 3 [...]","og_url":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-08-11T10:44:24+00:00","article_modified_time":"2017-08-24T14:36:25+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","type":"image\/png"}],"author":"Vikhyat Sharma","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Vikhyat Sharma","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/"},"author":{"name":"Vikhyat Sharma","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0"},"headline":"Using Redis Cache In Opencart","datePublished":"2017-08-11T10:44:24+00:00","dateModified":"2017-08-24T14:36:25+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/"},"wordCount":301,"commentCount":4,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","keywords":["cache","opencart","phpredis","redis","redis cache"],"articleSection":["opencart","php"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/","url":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/","name":"Using Redis Cache In Opencart - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","datePublished":"2017-08-11T10:44:24+00:00","dateModified":"2017-08-24T14:36:25+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","width":"825","height":"260"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/using-redis-cache-opencart\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Redis Cache In Opencart"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0","name":"Vikhyat Sharma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Vikhyat Sharma"},"url":"https:\/\/webkul.com\/blog\/author\/vikhyat-sharma83\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/92730","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/70"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=92730"}],"version-history":[{"count":5,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/92730\/revisions"}],"predecessor-version":[{"id":93616,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/92730\/revisions\/93616"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/84482"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=92730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=92730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=92730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}