Full Page Cache: Enterprise PageCache Model Cookie
Object : $this => class Enterprise_PageCache_Model_Cookie
Following constants is used in above class:
const COOKIE_CUSTOMER = ‘CUSTOMER’;
const COOKIE_CUSTOMER_GROUP = ‘CUSTOMER_INFO’;
const COOKIE_MESSAGE = ‘NEWMESSAGE’;
const COOKIE_CART = ‘CART’;
const COOKIE_COMPARE_LIST = ‘COMPARE’;
const COOKIE_POLL = ‘POLL’;
const COOKIE_RECENTLY_COMPARED = ‘RECENTLYCOMPARED’;
const COOKIE_WISHLIST = ‘WISHLIST’;
const COOKIE_WISHLIST_ITEMS = ‘WISHLIST_CNT’;
const COOKIE_CUSTOMER_LOGGED_IN = ‘CUSTOMER_AUTH’;
const COOKIE_FORM_KEY = ‘CACHED_FRONT_FORM_KEY’;
Subprocessors cookie names:
- const COOKIE_CATEGORY_PROCESSOR = ‘CATEGORY_INFO’;
Cookie to store last visited category id:
- const COOKIE_CATEGORY_ID = ‘LAST_CATEGORY’;
Customer segment ids cookie name:
- const CUSTOMER_SEGMENT_IDS = ‘CUSTOMER_SEGMENT_IDS’;
Cookie name for users who allowed cookie save:
- const IS_USER_ALLOWED_SAVE_COOKIE = ‘user_allowed_save_cookie’;
Following variables is used in above class:
- $_salt
Some important functions and its purpose in this class:
- getCategoryCookieValue() : This function is used for get catalog cookie value.
- setCategoryViewedCookieValue() : This function is used to set cookie with visited category id.
Functions in class Enterprise_PageCache_Model_Cookie
There are 9 functions are present in class Enterprise_PageCache_Model_Cookie
-
-
/**Retrieve encryption salt * @return null|sting **/
-
protected function _getSalt()
/**Set cookie with obscure value
* @param string $name The cookie name
* @param string $value The cookie value
* @param int $period Lifetime period
* @param string $path
* @param string $domain
* @param int|bool $secure
* @param bool $httponly
* @return Mage_Core_Model_Cookie **/
public function setObscure(
$name, $value, $period = null, $path = null,
$domain = null, $secure = null, $httponly =
null
) {
$value = md5($this->_getSalt() . $value);
return $this->set($name, $value, $period, $path, $domain, $secure, $httponly);
}
/** Keep customer cookies synchronized with customer session
*
* @return Enterprise_PageCache_Model_Cookie **/
public function updateCustomerCookies()
/** Register viewed product ids in cookie
* @param int|string|array $productIds
* @param int $countLimit
* @param bool $append **/
public static function registerViewedProducts($productIds, $countLimit, $append = true)
/**Set catalog cookie
* @param string $value **/
public static function setCategoryCookieValue($value)
{
setcookie(self::COOKIE_CATEGORY_PROCESSOR, $value, 0, '/');
}
/** Get catalog cookie
* @static * @return bool*/
public static function getCategoryCookieValue()
{
return (isset($_COOKIE[self::COOKIE_CATEGORY_PROCESSOR]))
? $_COOKIE[self::COOKIE_CATEGORY_PROCESSOR] : false;
}
/**Set cookie with visited category id
* @param int $id **/
public static function setCategoryViewedCookieValue($id)
{
setcookie(self::COOKIE_CATEGORY_ID, $id, 0, '/');
}
/** Set cookie with form key for cached front
* @param string $formKey **/
public static function setFormKeyCookieValue($formKey)
{
setcookie(self::COOKIE_FORM_KEY, $formKey, 0, '/');
}
/**Get form key cookie value
* @return string|bool **/
public static function getFormKeyCookieValue()
{
return (isset($_COOKIE[self::COOKIE_FORM_KEY])) ?
$_COOKIE[self::COOKIE_FORM_KEY] : false;
}
Variables : These values for Homepage (when not logged-in):
URL: https://localhost/oscp-store/mage-ent-test/index.php
$_salt = null
Variables : These values for Homepage(when logged-in):
URL: https://localhost/oscp-store/mage-ent-test/index.php
$_salt = f1b64e77da18310f9bd404ca22748142
Variables :These values for Product Listing Page(when logged-in):
URL: https://localhost/oscp-store/mage-ent-test/furniture
$_salt = 14e5edf2a11a1a557377d59e74f62ead
Variables: These values for Product Info Page(when logged-in):
URL: https://localhost/oscp-store/mage-ent-test/furniture/couch.html
$_salt = 14e5edf2a11a1a557377d59e74f62ead
