Skip to main content

Memcache with Magento : Magento speed like Rocket

Hi Fellas, I am sharing this article showing how we can use the power of memcache alnog with magento. One of major magento drawback would be its speed, although we can several ways to speed up. Memcache is good option as its new and fast.

Before starting lets know a bit about what is memcache. Memcache is used to fast access database, api and etc. For this it uses some space on server. For more information please visit: http://www.memcached.org/

You can use below method to apply memcache for Magento v1.9 and older.
Below are the steps for starting memcache on your magento store:

1) Go to app/etc/ and find local.xml file.
2) Find the </global> tag and paste below code before the tag.
<cache>
<cache>      
    <backend>memcached</backend>

    <slow_backend>database</slow_backend>

    <fast_backend>Memcached</fast_backend>

    <fast_backend_options>

        <servers>

            <server>

                <host><![CDATA[127.0.0.1]]></host>

                <port><![CDATA[11211]]></port>

                <persistent><![CDATA[1]]></persistent>

            </server>

        </servers>

    </fast_backend_options>

    <memcached>

        <servers>

            <server>

                <host><![CDATA[127.0.0.1]]></host>

                <port><![CDATA[11211]]></port>

                <persistent><![CDATA[1]]></persistent>

            </server>

        </servers>

        <compression><![CDATA[0]]></compression>

        <cache_dir><![CDATA[]]></cache_dir>

        <hashed_directory_level><![CDATA[]]></hashed_directory_level>

        <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>

        <file_name_prefix><![CDATA[]]></file_name_prefix>

    </memcached>

</cache>

Comments

Popular posts from this blog

Add Products to cart Programmatically in Magento

Sometimes we need to add products into cart programmatically in controller. Below is the code which you can use to add product to cart.   1) For Simple Products If you are working in magento controller and wants to add a simple product programmatically then here is the code: Suppose our product id value stored in $productId.         // Below code will create instance of cart         $cart = Mage::getModel('checkout/cart');         // This will initialize cart         $cart->init();         // Get the product collection by passing product id         $productCollection = Mage::getModel('catalog/product')->load($productId); This product collection will be required as we have to pass it at the time of adding product to cart. For adding the product we have to call addProduct() function. In this function we have to pass two parameters first is productcollection and second is an array. This array contains product id and quantity which we are going

Magento Multiple Store Setup

Many times we need to create multiple stores in magento website. In magento we create different stores to make it more local. We can access different stores using below ways: 1) Domain (e.g. www.store1.com and www.store2.com) 2) Subdomain (e.g. store1.mystore.com and store2.mystore.com) 3) Folder (e.g. mystore.com/store1/ and mystore.com/store2/) Its all upto to you which way you prefer. For all these we need to follow below steps: Step 1: Add new Magento store: It might be possible that both store have different  catalogue so to manage this. We need to make two different Base Categories. To create a new base category follow below steps: Log in to your Magento admin panel. Go to Catalog -> Manage Categories . If you want both your websites to share same “ Default Category ”, select it by clicking on it on the left. Or click Add Root Category to create a new root category different from the existing one. Once the category is selected, under the General

Quick Order Placement Form

If we want to place fast and quick order. We want to list all the product along with their categories  and price. For achieving this goal we have to follow these steps: 1) Create Template File : Create a template  file at /app/design/frontend/default/blanco/template/catalog/product/list_fast_order.phtml which will the list of all products along with their categories and Price listing. 2) Edit Layout : Before this we have to add the phtml file in catalog.xml file. 3) Get Result :  In list_fast_order.phtml file we have to show the product category wise /*assume we want to get all products of category id 5 */ $catid_1 = 5; /*we are loading all the products from category id 5 */ $_category = Mage::getModel('catalog/category')->load($catid_1); $subs = $_category->getAllChildren(true); /* Use for loop for making result array */ $result = array(); foreach($subs as $cat_id) { $category = new Mage_Catalog_Model_Category();