I have a class that is modeled as follows: all member variables are composed of strings and integers.
> class XYZ extends CFormModel
{
public $username;
public $analysis_type;
public $trace_selection;
public $filter_phantoms;
public $trace_oui_map;
public $frame_min;
public $frame_max;
public $time_end;
public $frame_range;
public $time_range;
private $RETURNURL;
private $PARAMS;
private $connection;
private $database;
private $col_trace_info;
private $col_csv;
...
...
I want to store this object of this class in the redis cache for better performance. The solutions I stumbled upon is to use hashmaps.
Yii::app()->cache()->executeCommand("HSET", array("KEY"=>$hashMap, "FIELD"=>$key, "VALUE"=>$object));
My question is, is there a better way to store an object in memory using any other data structure or serialize it before storing or something like that?
source
share