PDA

View Full Version : Storing session information


Kaitlyn2004
05-26-2008, 11:54 AM
I am working on a plugin which builds an array and I want to keep this in their session (or, ideally, for X minutes).

calling session_start() and then $_SESSION['my_var'] = [my array] seems to not exactly have the desired effect and it is causing the page to be forceably reloaded through the Cache-Control header.

What is the best way to store this information so it doesn't have to be queried/built on every page load? I'm new to vB modification programming...

Dismounted
05-26-2008, 12:05 PM
vBulletin doesn't use PHP sessions.

Kaitlyn2004
05-26-2008, 12:56 PM
vBulletin doesn't use PHP sessions.

Which I quickly learned :)

So what method should I use to store this? Should I create another column in the sess table and just store it as serialized, or what?

Opserty
05-26-2008, 01:38 PM
If you decide to create another column you may find this helpful: [How-To] Extend and use the Session Table Effectively (https://vborg.vbsupport.ru/showthread.php?t=152344&highlight=session)

Kaitlyn2004
05-26-2008, 02:44 PM
If you decide to create another column you may find this helpful: [How-To] Extend and use the Session Table Effectively (https://vborg.vbsupport.ru/showthread.php?t=152344&highlight=session)

Thanks.

Is that the "best" way to accomplish what I want?

Edit: Just realized it's a MEMORY table and therefore I can't store a serialized array in that table... there won't be enough room. Ideas?

Dismounted
05-27-2008, 07:16 AM
Do you really need to store a whole array?

Kaitlyn2004
05-27-2008, 11:14 AM
Do you really need to store a whole array?

Instead of running the query on every load and then building the array, yes.