I have console app starting by cron. I want it to have only one copy running simultaneously.
Is the best way to store state flag to use CStatePersister?
Is there way to store state without loading/saving all state information or only like in code below?
<?php // state saving $sp = Yii::app()->getStatePersister(); $state = $sp->load(); $state['flag'] = $myState; $sp->save($state); // state loading $state = $sp->load(); $myState = isset($state['flag']) ? $state['flag'] : false; ?>
Maybe there is more pretty way to do such thing?