Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 10-12-2017 05:16:06

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1716

Best approach to replace $this->CORE_Session->sessvalues

Hi Nick

So what the best approach for updating mods with $this->CORE_Session->sessvalues

A simple example would be the VAT Display mod, whereby user selects whether prices are shown with VAT and this was saved to their session.

Can I just use $this->CORE_Session->sessupdate (which works correctly)
or should I set a new cookie??


Rob

Offline

 

#2 10-12-2017 09:20:40

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19861
Website

Re: Best approach to replace $this->CORE_Session->sessvalues

sessvalues() is gone from CORE_Session as of 9.0.2, as you've just discovered.  sessupdate() is it's replacement - look at that function and decide how to best call it - it has more parameters than sessvalues() did and operates quite differently, although the end result is saving data to the session.

A big part of the resource savings you see in 9.0.2 has to do with a few basic things: User account sessions moved data storage so they use the core_users table only; Sessions in core_sessions are created for guests on-demand (when needed, when there's data to save) only; Many common session variables (like breadcrumbs/location, currency selection, etc) were moved to their own dedicated cookies so as to not have to create/save core_session data for them.

When approaching a situation like yours, the first thing to ask yourself is if this is a piece of data that will be saved and updated for everyone, or just a few people.  If it's for everyone, and very commonly used, attack this by checking/setting your own cookie.  If it's only used every once in a while, or becomes important once more session data (like checkout info, a cart, etc) is added to a session, the best place to put it is in the session.  Try to keep storage in core_sessions minimal in order to keep performance at a high level.

Savvy?


Nick Hendler

Offline

 

#3 10-12-2017 09:30:16

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1716

Re: Best approach to replace $this->CORE_Session->sessvalues

Loud and Clear.


Rob

Offline

 

#4 10-13-2017 08:52:02

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19861
Website

Re: Best approach to replace $this->CORE_Session->sessvalues

Cool.  I've been thinking a bit more on this one.  I think the decision of whether to use CORE_Session to manage your own cookie, or use it to store session data for the user/guest, should be based on whether the data being stored is too large to store in a cookie (checkout session data) or important to track (name, address, cart id) or contains data which the user/guest shouldn't have access to via cookie.  Those cases call for storing session data.  All others call for a cookie.  In your case I'd go cookie all the way.


Nick Hendler

Offline

 

Board footer