Session value not working in blocks when FPC cache enabled.How to handle the session value in cache enabled blocks.I have added the customer session id as below.How to get the customer id from cache in a block.
public function getCacheKeyInfo() {
$info = parent::getCacheKeyInfo();
$info['current_product_id'] = Mage::registry('current_product')->getId();
$info['customer_id'] = Mage::getSingleton('customer/session')->getCustomerId();
return $info;
}
In this case you need to return a custom value from the
getCacheKey
method, for example:But please keep in mind this will not have any effect if your FPC (FULL page cache) is enabled. Because FULL page cache is not what you're asking for with your question.
What should I do if i where you?
What I would prefer in your situation is to skip caching specific (user) blocks when a user is loggedin.