Can you save a variable in session? Is there any way to save a variable in the Craft session inside a controller?

I'm running a cron job and I need to store a variable as a session for every run to see if a condition matches.
Craft's HttpSessionService is a thin wrapper for PHP's global $_SESSION variable.

You can use:

craft()-&gt;httpSession-&gt;add($key, $value)


and:

craft()-&gt;httpSession-&gt;get($key)


to save and retrieve values from it.