NYCPHP Meetup

NYPHP.org

[nycphp-talk] aggregate views on serialized session data WAS: session size important?

Dan Cech dcech at phpwerx.net
Thu Apr 21 18:45:35 EDT 2005


Mitch,

What I did was to create a table with several columns like:

session_id,user_id,activity_timestamp,session_data

Then with custom session handlers you can maintain the whole table 
automatically, and pull data from it to generate the aggregates.

I found low-level gzip compression to be great at reducing the size of 
the session data for storage without adding too much overhead.

If you're interested in this stuff contact me off-list and I can give 
you a complete rundown, code samples, etc.

Dan

Mitch Pirtle wrote:
> On 4/21/05, Dan Cech <dcech at phpwerx.net> wrote:
> 
>>I did it by writing my own session handlers which take the $_SESSION
>>array, serialize and (optionally) gzip it, then store the result in a
>>table.  A big advantage of this method is that you can store other
>>useful data in the session like the activity time, user_id, etc for
>>generating 'who's online' type reports, session timeouts, or whatever
>>else might come in handy.
> 
> 
> Ooh ooh ooh!
> 
> *mitchy holds up hand
> 
> Then if you are storing whether someone is online or not in a
> serialized array in a database, how can you get aggregate views?  "X
> of XXX people online from NYC" and so on.
> 
> I am just not content with the most common approaches to this problem,
> and would love to learn how others deal with it.
> 
> -- Mitch
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org




More information about the talk mailing list