diff options
| author | 2024-04-02 11:03:40 +0100 | |
|---|---|---|
| committer | 2024-04-02 12:03:40 +0200 | |
| commit | adf345f1ec0cb76a0df94a4505143d891659cba9 (patch) | |
| tree | e0cca289c0a50f30191d4b65a2c336704570e470 /internal/cache/invalidate.go | |
| parent | [feature] Option to hide followers/following (#2788) (diff) | |
| download | gotosocial-adf345f1ec0cb76a0df94a4505143d891659cba9.tar.xz | |
[chore] bump go structr cache version -> v0.6.0 (#2773)
* update go-structr library -> v0.6.0, add necessary wrapping types + code changes to support these changes
* update readme with go-structr package changes
* improved wrapping of the SliceCache type
* add code comments for the cache wrapper types
* remove test.out :innocent:
---------
Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Diffstat (limited to 'internal/cache/invalidate.go')
| -rw-r--r-- | internal/cache/invalidate.go | 24 | 
1 files changed, 11 insertions, 13 deletions
diff --git a/internal/cache/invalidate.go b/internal/cache/invalidate.go index a7c4a1552..746d8c7e7 100644 --- a/internal/cache/invalidate.go +++ b/internal/cache/invalidate.go @@ -37,7 +37,7 @@ func (c *Caches) OnInvalidateAccount(account *gtsmodel.Account) {  	// Invalidate this account's  	// following / follower lists.  	// (see FollowIDs() comment for details). -	c.GTS.FollowIDs.InvalidateAll( +	c.GTS.FollowIDs.Invalidate(  		">"+account.ID,  		"l>"+account.ID,  		"<"+account.ID, @@ -47,7 +47,7 @@ func (c *Caches) OnInvalidateAccount(account *gtsmodel.Account) {  	// Invalidate this account's  	// follow requesting / request lists.  	// (see FollowRequestIDs() comment for details). -	c.GTS.FollowRequestIDs.InvalidateAll( +	c.GTS.FollowRequestIDs.Invalidate(  		">"+account.ID,  		"<"+account.ID,  	) @@ -96,7 +96,7 @@ func (c *Caches) OnInvalidateFollow(follow *gtsmodel.Follow) {  	// Invalidate source account's following  	// lists, and destination's follwer lists.  	// (see FollowIDs() comment for details). -	c.GTS.FollowIDs.InvalidateAll( +	c.GTS.FollowIDs.Invalidate(  		">"+follow.AccountID,  		"l>"+follow.AccountID,  		"<"+follow.AccountID, @@ -115,7 +115,7 @@ func (c *Caches) OnInvalidateFollowRequest(followReq *gtsmodel.FollowRequest) {  	// Invalidate source account's followreq  	// lists, and destinations follow req lists.  	// (see FollowRequestIDs() comment for details). -	c.GTS.FollowRequestIDs.InvalidateAll( +	c.GTS.FollowRequestIDs.Invalidate(  		">"+followReq.AccountID,  		"<"+followReq.AccountID,  		">"+followReq.TargetAccountID, @@ -164,15 +164,13 @@ func (c *Caches) OnInvalidateStatus(status *gtsmodel.Status) {  	// Invalidate status ID cached visibility.  	c.Visibility.Invalidate("ItemID", status.ID) -	for _, id := range status.AttachmentIDs { -		// Invalidate each media by the IDs we're aware of. -		// This must be done as the status table is aware of -		// the media IDs in use before the media table is -		// aware of the status ID they are linked to. -		// -		// c.GTS.Media().Invalidate("StatusID") will not work. -		c.GTS.Media.Invalidate("ID", id) -	} +	// Invalidate each media by the IDs we're aware of. +	// This must be done as the status table is aware of +	// the media IDs in use before the media table is +	// aware of the status ID they are linked to. +	// +	// c.GTS.Media().Invalidate("StatusID") will not work. +	c.GTS.Media.InvalidateIDs("ID", status.AttachmentIDs)  	if status.BoostOfID != "" {  		// Invalidate boost ID list of the original status.  | 
