mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[performance] cached oauth database types (#2838)
* update token + client code to use struct caches * add code comments * slight tweak to default mem ratios * fix envparsing * add appropriate invalidate hooks * update the tokenstore sweeping function to rely on caches * update to use PutClient() * add ClientID to list of token struct indices
This commit is contained in:
10
internal/cache/invalidate.go
vendored
10
internal/cache/invalidate.go
vendored
@ -60,6 +60,11 @@ func (c *Caches) OnInvalidateAccount(account *gtsmodel.Account) {
|
||||
c.GTS.Move.Invalidate("TargetURI", account.URI)
|
||||
}
|
||||
|
||||
func (c *Caches) OnInvalidateApplication(app *gtsmodel.Application) {
|
||||
// Invalidate cached client of this application.
|
||||
c.GTS.Client.Invalidate("ID", app.ClientID)
|
||||
}
|
||||
|
||||
func (c *Caches) OnInvalidateBlock(block *gtsmodel.Block) {
|
||||
// Invalidate block origin account ID cached visibility.
|
||||
c.Visibility.Invalidate("ItemID", block.AccountID)
|
||||
@ -73,6 +78,11 @@ func (c *Caches) OnInvalidateBlock(block *gtsmodel.Block) {
|
||||
c.GTS.BlockIDs.Invalidate(block.AccountID)
|
||||
}
|
||||
|
||||
func (c *Caches) OnInvalidateClient(client *gtsmodel.Client) {
|
||||
// Invalidate any tokens under this client.
|
||||
c.GTS.Token.Invalidate("ClientID", client.ID)
|
||||
}
|
||||
|
||||
func (c *Caches) OnInvalidateEmojiCategory(category *gtsmodel.EmojiCategory) {
|
||||
// Invalidate any emoji in this category.
|
||||
c.GTS.Emoji.Invalidate("CategoryID", category.ID)
|
||||
|
Reference in New Issue
Block a user