mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-15 05:53:01 -06:00
[performance] replace domain block cache with an in-memory radix trie (#1714)
* replace domain block cache with an in-memory radix tree Signed-off-by: kim <grufwub@gmail.com> * fix domain block cache init Signed-off-by: kim <grufwub@gmail.com> --------- Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
66f09a8d93
commit
3ff1391a9d
3 changed files with 166 additions and 122 deletions
12
internal/cache/gts.go
vendored
12
internal/cache/gts.go
vendored
|
|
@ -72,12 +72,6 @@ func (c *GTSCaches) Init() {
|
|||
func (c *GTSCaches) Start() {
|
||||
tryStart(c.account, config.GetCacheGTSAccountSweepFreq())
|
||||
tryStart(c.block, config.GetCacheGTSBlockSweepFreq())
|
||||
tryUntil("starting domain block cache", 5, func() bool {
|
||||
if sweep := config.GetCacheGTSDomainBlockSweepFreq(); sweep > 0 {
|
||||
return c.domainBlock.Start(sweep)
|
||||
}
|
||||
return true
|
||||
})
|
||||
tryStart(c.emoji, config.GetCacheGTSEmojiSweepFreq())
|
||||
tryStart(c.emojiCategory, config.GetCacheGTSEmojiCategorySweepFreq())
|
||||
tryStart(c.follow, config.GetCacheGTSFollowSweepFreq())
|
||||
|
|
@ -102,7 +96,6 @@ func (c *GTSCaches) Start() {
|
|||
func (c *GTSCaches) Stop() {
|
||||
tryStop(c.account, config.GetCacheGTSAccountSweepFreq())
|
||||
tryStop(c.block, config.GetCacheGTSBlockSweepFreq())
|
||||
tryUntil("stopping domain block cache", 5, c.domainBlock.Stop)
|
||||
tryStop(c.emoji, config.GetCacheGTSEmojiSweepFreq())
|
||||
tryStop(c.emojiCategory, config.GetCacheGTSEmojiCategorySweepFreq())
|
||||
tryStop(c.follow, config.GetCacheGTSFollowSweepFreq())
|
||||
|
|
@ -233,10 +226,7 @@ func (c *GTSCaches) initBlock() {
|
|||
}
|
||||
|
||||
func (c *GTSCaches) initDomainBlock() {
|
||||
c.domainBlock = domain.New(
|
||||
config.GetCacheGTSDomainBlockMaxSize(),
|
||||
config.GetCacheGTSDomainBlockTTL(),
|
||||
)
|
||||
c.domainBlock = new(domain.BlockCache)
|
||||
}
|
||||
|
||||
func (c *GTSCaches) initEmoji() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue