🐛 Fix more older cache issue

This commit is contained in:
LittleSheep 2024-12-29 01:58:26 +08:00
parent d979f85f68
commit 0e0ad9c261

View File

@ -86,6 +86,10 @@ func (v *Attachment) AfterUpdate(tx *gorm.DB) error {
ctx, ctx,
fmt.Sprintf("attachment#%s", v.Rid), fmt.Sprintf("attachment#%s", v.Rid),
) )
_ = marshal.Delete(
ctx,
fmt.Sprintf("attachment-open#%s", v.Rid),
)
return nil return nil
} }
@ -119,6 +123,19 @@ type AttachmentFragment struct {
FileChunksMissing []string `json:"file_chunks_missing" gorm:"-"` // This field use to prompt client which chunks is pending upload, do not store it FileChunksMissing []string `json:"file_chunks_missing" gorm:"-"` // This field use to prompt client which chunks is pending upload, do not store it
} }
func (v *AttachmentFragment) AfterUpdate(tx *gorm.DB) error {
cacheManager := cache.New[any](localCache.S)
marshal := marshaler.New(cacheManager)
ctx := context.Background()
_ = marshal.Delete(
ctx,
fmt.Sprintf("attachment-fragment#%s", v.Rid),
)
return nil
}
func (v AttachmentFragment) ToAttachment() Attachment { func (v AttachmentFragment) ToAttachment() Attachment {
return Attachment{ return Attachment{
Rid: v.Rid, Rid: v.Rid,