In one of my previous forum posts Derek suggested that I use the $SESS global to store my settings.
The question I have is when the extension settings are updated how can I clear the $SESS variable?
Heres what I have so far when accessing the settings from the plugin:
if ( ! isset($SESS->cache['lg_better_meta']['settings']))
{
$query = $DB->query("SELECT settings FROM exp_extensions WHERE class = 'lg_better_meta' LIMIT 1");
if ($query->num_rows > 0)
{
foreach ($query->result as $row)
{
$SESS->cache['lg_better_meta']['settings'] = $row;
}
}
}
$settings = unserialize($SESS->cache['lg_better_meta']['settings']);
The session cache lives only for the runtime of each request. Why would you want to kill those settings in that timeframe?
If you are completely sure you want to kill them, use unset().
e.g.,
unset($SESS->cache['lg_better_meta']['settings']);
But watch your queries take a hike if the extension is being called more than once 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.