我有一个类,这样建模,所有成员变量都包含字符串和整数.
> class XYZ extends CFormModel { //Values required for rendering the Dashboard 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; //Other Values private $RETURNURL; private $PARAMS; private $connection; // connection to db client private $database; // handle to database private $col_trace_info; // handle to trace_info collection private $col_csv; // handle to csv collection ... ...
我想将此类的此对象存储在redis缓存中以提高性能.我偶然发现的解决方案是使用hashmaps ..
Yii::app()->cache()->executeCommand("HSET", array("KEY"=>$hashMap, "FIELD"=>$key, "VALUE"=>$object));
我的问题是,有没有更好的方法来存储对象在内存中,通过使用任何其他数据结构或在存储之前序列化它,或类似的东西?