fix: 设备变更时同步清除用户缓存,修复 user_devices 为空问题
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m23s
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m23s
Device.GetCacheKeys() 新增 cacheUserIdPrefix+UserId,
确保 InsertDevice/UpdateDevice/DeleteDevice 时同时失效
cache:user:id:{userId},避免下次 FindOne 读到不含
UserDevices 的旧缓存。
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
abc9864d46
commit
ea34718a0b
@ -102,6 +102,9 @@ func (d *Device) GetCacheKeys() []string {
|
|||||||
if d.Identifier != "" {
|
if d.Identifier != "" {
|
||||||
keys = append(keys, fmt.Sprintf("%s%s", cacheUserDeviceNumberPrefix, d.Identifier))
|
keys = append(keys, fmt.Sprintf("%s%s", cacheUserDeviceNumberPrefix, d.Identifier))
|
||||||
}
|
}
|
||||||
|
if d.UserId != 0 {
|
||||||
|
keys = append(keys, fmt.Sprintf("%s%d", cacheUserIdPrefix, d.UserId))
|
||||||
|
}
|
||||||
return keys
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user