summaryrefslogtreecommitdiff
path: root/internal/cache
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-09-21 19:55:52 +0200
committerLibravatar GitHub <noreply@github.com>2022-09-21 19:55:52 +0200
commit4cf76a2bfcc2c19bdd34f1bd58d8545d3499481b (patch)
tree47f558153875675cd7e4d0109e1028d2101ff8da /internal/cache
parent[docs] Add --config-path to example CLI commands where needed. (#843) (diff)
downloadgotosocial-4cf76a2bfcc2c19bdd34f1bd58d8545d3499481b.tar.xz
[chore] Tidy up status deletion, remove from cache too (#845)
* add func for deleting status from db + cache * move deletes entirely back to processor and also only do a delete if the requesting account owns the item being deleted * tidy up unboost processing * delete status more efficiently * fix wrong account id on remote test attachments * fix federator test
Diffstat (limited to 'internal/cache')
-rw-r--r--internal/cache/status.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/cache/status.go b/internal/cache/status.go
index f3cbce779..898b50846 100644
--- a/internal/cache/status.go
+++ b/internal/cache/status.go
@@ -85,6 +85,11 @@ func (c *StatusCache) Put(status *gtsmodel.Status) {
c.cache.Set(status.ID, copyStatus(status))
}
+// Invalidate invalidates one status from the cache using the ID of the status as key.
+func (c *StatusCache) Invalidate(statusID string) {
+ c.cache.Invalidate(statusID)
+}
+
// copyStatus performs a surface-level copy of status, only keeping attached IDs intact, not the objects.
// due to all the data being copied being 99% primitive types or strings (which are immutable and passed by ptr)
// this should be a relatively cheap process