diff options
Diffstat (limited to 'internal/cache')
| -rw-r--r-- | internal/cache/gts.go | 21 | 
1 files changed, 21 insertions, 0 deletions
| diff --git a/internal/cache/gts.go b/internal/cache/gts.go index 81c6e9f9e..dd43154ef 100644 --- a/internal/cache/gts.go +++ b/internal/cache/gts.go @@ -39,6 +39,7 @@ type GTSCaches struct {  	instance      *result.Cache[*gtsmodel.Instance]  	list          *result.Cache[*gtsmodel.List]  	listEntry     *result.Cache[*gtsmodel.ListEntry] +	marker        *result.Cache[*gtsmodel.Marker]  	media         *result.Cache[*gtsmodel.MediaAttachment]  	mention       *result.Cache[*gtsmodel.Mention]  	notification  *result.Cache[*gtsmodel.Notification] @@ -65,6 +66,7 @@ func (c *GTSCaches) Init() {  	c.initInstance()  	c.initList()  	c.initListEntry() +	c.initMarker()  	c.initMedia()  	c.initMention()  	c.initNotification() @@ -88,6 +90,7 @@ func (c *GTSCaches) Start() {  	tryStart(c.instance, config.GetCacheGTSInstanceSweepFreq())  	tryStart(c.list, config.GetCacheGTSListSweepFreq())  	tryStart(c.listEntry, config.GetCacheGTSListEntrySweepFreq()) +	tryStart(c.marker, config.GetCacheGTSMarkerSweepFreq())  	tryStart(c.media, config.GetCacheGTSMediaSweepFreq())  	tryStart(c.mention, config.GetCacheGTSMentionSweepFreq())  	tryStart(c.notification, config.GetCacheGTSNotificationSweepFreq()) @@ -116,6 +119,7 @@ func (c *GTSCaches) Stop() {  	tryStop(c.instance, config.GetCacheGTSInstanceSweepFreq())  	tryStop(c.list, config.GetCacheGTSListSweepFreq())  	tryStop(c.listEntry, config.GetCacheGTSListEntrySweepFreq()) +	tryStop(c.marker, config.GetCacheGTSMarkerSweepFreq())  	tryStop(c.media, config.GetCacheGTSMediaSweepFreq())  	tryStop(c.mention, config.GetCacheGTSNotificationSweepFreq())  	tryStop(c.notification, config.GetCacheGTSNotificationSweepFreq()) @@ -182,6 +186,11 @@ func (c *GTSCaches) ListEntry() *result.Cache[*gtsmodel.ListEntry] {  	return c.listEntry  } +// Marker provides access to the gtsmodel Marker database cache. +func (c *GTSCaches) Marker() *result.Cache[*gtsmodel.Marker] { +	return c.marker +} +  // Media provides access to the gtsmodel Media database cache.  func (c *GTSCaches) Media() *result.Cache[*gtsmodel.MediaAttachment] {  	return c.media @@ -372,6 +381,18 @@ func (c *GTSCaches) initListEntry() {  	c.list.IgnoreErrors(ignoreErrors)  } +func (c *GTSCaches) initMarker() { +	c.marker = result.New([]result.Lookup{ +		{Name: "AccountID.Name"}, +	}, func(m1 *gtsmodel.Marker) *gtsmodel.Marker { +		m2 := new(gtsmodel.Marker) +		*m2 = *m1 +		return m2 +	}, config.GetCacheGTSMarkerMaxSize()) +	c.marker.SetTTL(config.GetCacheGTSMarkerTTL(), true) +	c.marker.IgnoreErrors(ignoreErrors) +} +  func (c *GTSCaches) initMedia() {  	c.media = result.New([]result.Lookup{  		{Name: "ID"}, | 
