Skip to content

Memcache Configuration and Usage

The memcache Info seen by clicking Memcache to expand the section , then Info, is minimal. Here you can manually flush memcache of all keys if needed. The memcache service is always running by default.

Magento Configuration

Per our configuration best practice for sessions, use the snippets below to use memcache for sessions on your store.

Magento 1

Edit your session block in local.xml to enable Memcache sessions on your Magento 1 store.


Then flush the Magento cache with:

n98-magerun cache:clean


Edit your session block in env.phpto enable Memcache sessions on your Magento 2 store.

<? php
'session' =>
   array (
      'save' => 'memcache',
      'save_path' => 'tcp://memcache:11211'

Then flush the Magento cache with:

n98-magerun2 cache:clean

Getting data out of Memcache

If you are a try hard and want to go look at things in memcache directly, do so with telnet. If memcache sessions are enabled and a session exists you will see output similar to below. Type quit to exit your telnet session.

magemojo@svc-magentoperformance-io:~/public_html$ telnet memcache 11211
Connected to
Escape character is '^]'.
stats items
STAT items:11:number 1
STAT items:11:number_hot 0
STAT items:11:number_warm 0
STAT items:11:number_cold 1
STAT items:11:age_hot 0
STAT items:11:age_warm 0
STAT items:11:age 8
STAT items:11:evicted 0
STAT items:11:evicted_nonzero 0
STAT items:11:evicted_time 0
STAT items:11:outofmemory 0
STAT items:11:tailrepairs 0
STAT items:11:reclaimed 0
STAT items:11:expired_unfetched 0
STAT items:11:evicted_unfetched 0
STAT items:11:evicted_active 0
STAT items:11:crawler_reclaimed 0
STAT items:11:crawler_items_checked 0
STAT items:11:lrutail_reflocked 0
STAT items:11:moves_to_cold 2
STAT items:11:moves_to_warm 0
STAT items:11:moves_within_lru 0
STAT items:11:direct_reclaims 0
STAT items:11:hits_to_hot 1
STAT items:11:hits_to_warm 0
STAT items:11:hits_to_cold 2
STAT items:11:hits_to_temp 0