cache

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Possible cache visibility lookup types.
	VisibilityTypeAccount = VisibilityType('a')
	VisibilityTypeStatus  = VisibilityType('s')
	VisibilityTypeHome    = VisibilityType('h')
	VisibilityTypePublic  = VisibilityType('p')
)

Variables

View Source
var SentinelError = errors.New("BUG: error should not be returned") //nolint:revive

SentinelError is returned to indicate a non-permanent error return, i.e. a situation in which we do not want a cache a negative result.

Functions

This section is empty.

Types

type APCaches added in v0.7.0

type APCaches struct{}

func (*APCaches) Init added in v0.7.0

func (c *APCaches) Init()

Init will initialize all the ActivityPub caches in this collection. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.

func (*APCaches) Start added in v0.7.0

func (c *APCaches) Start()

Start will attempt to start all of the ActivityPub caches, or panic.

func (*APCaches) Stop added in v0.7.0

func (c *APCaches) Stop()

Stop will attempt to stop all of the ActivityPub caches, or panic.

type CachedVisibility added in v0.8.0

type CachedVisibility struct {
	// ItemID is the ID of the item in question (status / account).
	ItemID string

	// RequesterID is the ID of the requesting account for this visibility lookup.
	RequesterID string

	// Type is the visibility lookup type.
	Type VisibilityType

	// Value is the actual visibility value.
	Value bool
}

CachedVisibility represents a cached visibility lookup value.

type Caches added in v0.7.0

type Caches struct {
	// GTS provides access to the collection of gtsmodel object caches.
	// (used by the database).
	GTS GTSCaches

	// AP provides access to the collection of ActivityPub object caches.
	// (planned to be used by the typeconverter).
	AP APCaches

	// Visibility provides access to the item visibility cache.
	// (used by the visibility filter).
	Visibility VisibilityCache
	// contains filtered or unexported fields
}

func (*Caches) Init added in v0.7.0

func (c *Caches) Init()

Init will (re)initialize both the GTS and AP cache collections. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.

func (*Caches) Start added in v0.7.0

func (c *Caches) Start()

Start will start both the GTS and AP cache collections.

func (*Caches) Stop added in v0.7.0

func (c *Caches) Stop()

Stop will stop both the GTS and AP cache collections.

type GTSCaches added in v0.7.0

type GTSCaches struct {
	// contains filtered or unexported fields
}

func (*GTSCaches) Account added in v0.7.0

func (c *GTSCaches) Account() *result.Cache[*gtsmodel.Account]

Account provides access to the gtsmodel Account database cache.

func (*GTSCaches) Block added in v0.7.0

func (c *GTSCaches) Block() *result.Cache[*gtsmodel.Block]

Block provides access to the gtsmodel Block (account) database cache.

func (*GTSCaches) DomainBlock added in v0.7.0

func (c *GTSCaches) DomainBlock() *domain.BlockCache

DomainBlock provides access to the domain block database cache.

func (*GTSCaches) Emoji added in v0.7.0

func (c *GTSCaches) Emoji() *result.Cache[*gtsmodel.Emoji]

Emoji provides access to the gtsmodel Emoji database cache.

func (*GTSCaches) EmojiCategory added in v0.7.0

func (c *GTSCaches) EmojiCategory() *result.Cache[*gtsmodel.EmojiCategory]

EmojiCategory provides access to the gtsmodel EmojiCategory database cache.

func (*GTSCaches) Follow added in v0.8.0

func (c *GTSCaches) Follow() *result.Cache[*gtsmodel.Follow]

Follow provides access to the gtsmodel Follow database cache.

func (*GTSCaches) FollowRequest added in v0.8.0

func (c *GTSCaches) FollowRequest() *result.Cache[*gtsmodel.FollowRequest]

FollowRequest provides access to the gtsmodel FollowRequest database cache.

func (*GTSCaches) Init added in v0.7.0

func (c *GTSCaches) Init()

Init will initialize all the gtsmodel caches in this collection. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.

func (*GTSCaches) Instance added in v0.10.0

func (c *GTSCaches) Instance() *result.Cache[*gtsmodel.Instance]

Instance provides access to the gtsmodel Instance database cache.

func (*GTSCaches) List added in v0.10.0

func (c *GTSCaches) List() *result.Cache[*gtsmodel.List]

List provides access to the gtsmodel List database cache.

func (*GTSCaches) ListEntry added in v0.10.0

func (c *GTSCaches) ListEntry() *result.Cache[*gtsmodel.ListEntry]

ListEntry provides access to the gtsmodel ListEntry database cache.

func (*GTSCaches) Media added in v0.8.0

Media provides access to the gtsmodel Media database cache.

func (*GTSCaches) Mention added in v0.7.0

func (c *GTSCaches) Mention() *result.Cache[*gtsmodel.Mention]

Mention provides access to the gtsmodel Mention database cache.

func (*GTSCaches) Notification added in v0.7.0

func (c *GTSCaches) Notification() *result.Cache[*gtsmodel.Notification]

Notification provides access to the gtsmodel Notification database cache.

func (*GTSCaches) Report added in v0.7.0

func (c *GTSCaches) Report() *result.Cache[*gtsmodel.Report]

Report provides access to the gtsmodel Report database cache.

func (*GTSCaches) Start added in v0.7.0

func (c *GTSCaches) Start()

Start will attempt to start all of the gtsmodel caches, or panic.

func (*GTSCaches) Status added in v0.7.0

func (c *GTSCaches) Status() *result.Cache[*gtsmodel.Status]

Status provides access to the gtsmodel Status database cache.

func (*GTSCaches) StatusFave added in v0.8.0

func (c *GTSCaches) StatusFave() *result.Cache[*gtsmodel.StatusFave]

StatusFave provides access to the gtsmodel StatusFave database cache.

func (*GTSCaches) Stop added in v0.7.0

func (c *GTSCaches) Stop()

Stop will attempt to stop all of the gtsmodel caches, or panic.

func (*GTSCaches) Tombstone added in v0.7.0

func (c *GTSCaches) Tombstone() *result.Cache[*gtsmodel.Tombstone]

Tombstone provides access to the gtsmodel Tombstone database cache.

func (*GTSCaches) User added in v0.7.0

func (c *GTSCaches) User() *result.Cache[*gtsmodel.User]

User provides access to the gtsmodel User database cache.

func (*GTSCaches) Webfinger added in v0.8.0

func (c *GTSCaches) Webfinger() *ttl.Cache[string, string]

Webfinger provides access to the webfinger URL cache.

type VisibilityCache added in v0.8.0

type VisibilityCache struct {
	*result.Cache[*CachedVisibility]
}

func (*VisibilityCache) Init added in v0.8.0

func (c *VisibilityCache) Init()

Init will initialize the visibility cache in this collection. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.

func (*VisibilityCache) Start added in v0.8.0

func (c *VisibilityCache) Start()

Start will attempt to start the visibility cache, or panic.

func (*VisibilityCache) Stop added in v0.8.0

func (c *VisibilityCache) Stop()

Stop will attempt to stop the visibility cache, or panic.

type VisibilityType added in v0.8.0

type VisibilityType byte

VisibilityType represents a visibility lookup type. We use a byte type here to improve performance in the result cache when generating the key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL