pub fn php_unserialize<T: DeserializeOwned>(
value: &CacheValue,
) -> Result<Option<T>, CacheError>Expand description
反序列化值(对齐 PHP Driver::unserialize($data))
PHP Driver::unserialize($data) 第 623 行:
is_numeric($data)→ 返回 string(⚠️ PHP 源码 bug:不还原为 int)- 否则 →
unserialize($data)
§泛型
T = String:对齐 PHPunserialize对 numeric 返回 string 的行为T = Other:使用serde_json::from_str还原
注意:若想获取 i64,需调用方自行 .parse::<i64>(),
对齐 PHP 业务代码中 (int) Cache::get('count') 的强转模式。