/** * 根据offset及配额获取缓存数据(如果有) * * @param string $index * @param array $config * @return fiexd */ public static function delete_orm_cache_data(OOP_ORM_Data $data_obj, $index, $config) { # 获取一个key $key = OOP_ORM_Parse::get_orm_cache_key($data_obj, $index, $config); # 清除缓存 return Cache::instance($config['cache']['driver_config'])->delete($key); }
/** * 根据offset及配额设置缓存数据 * * @param string $index * @param array $config * @param data * * @return boolean */ public static function set_orm_cache_data(OOP_ORM_Data $data_obj, $key, $config, $data) { # 获取一个key $cache_key = OOP_ORM_Parse::get_orm_cache_key($data_obj, $key, $config); $cache = new Cache($config['cache']['driver_config']); return $cache->set($cache_key, $data, isset($config['cache']['expire']) ? $config['cache']['expire'] : 3600, $config['cache']['expire_type']); }