We apologize for the instability of composr.app and appreciate your patience. We are working on the statistics addon and trying to find an optimal way to store and render data. Unfortunately, we have yet to find a solution that can handle the traffic (and therefore, tens of millions of statistical records) of composr.app. We're working hard on one.
$GLOBALS['SITE_DB']->create_table('session_data', array(
's_session_id' => '*ID_TEXT',
's_key' => '*ID_TEXT',
's_val' => 'LONG_TEXT',
));
function get_session_val($key)
{
return $GLOBALS['SITE_DB']->query_select_value_if_there('session_data', 's_val', array(
's_session_id' => get_session_id(true),
's_key' => $key,
));
}
function set_session_val($key, $val)
{
$GLOBALS['SITE_DB']->query_delete('session_data', array(
's_session_id' => get_session_id(true),
's_key' => $key,
));
if ($val !== null) {
$GLOBALS['SITE_DB']->query_insert('session_data', array(
's_session_id' => get_session_id(true),
's_key' => $key,
's_val' => $val,
));
}
}
The query_delete/query_insert combo could be replaced with query_insert_or_replace in v11+.
Implementation needs to consider cases where a user might actually want these values to be cleared (e.g. they clear their browser cookies).