cache

package
v0.0.0-...-1120f02 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache represents a thread-safe map

func New

func New() *Cache

func (*Cache) Delete

func (c *Cache) Delete(key string)

func (*Cache) Get

func (c *Cache) Get(key string) (interface{}, bool)

func (*Cache) Len

func (c *Cache) Len() int

func (*Cache) MustGet

func (c *Cache) MustGet(key string) interface{}

func (*Cache) Set

func (c *Cache) Set(key string, value interface{})

type CachedPost

type CachedPost struct {
	AuthorID string
	Parent   bool
	Children []*MessageInfo
}

CachedEmbed stores information about an embed that's later retrieved in OnReactionAdd event to let original poster remove the embed or the entire gallery posted by Boe Tea if reaction was added on their original message. Children array is filled for parent messages only and it contains all embeds sent by Boe Tea by posting the message, including crossposted messages.

type EmbedCache

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

func NewEmbedCache

func NewEmbedCache() *EmbedCache

NewEmbedCache creates a new embed cache for storing IDs of embeds users posted.

func (*EmbedCache) Get

func (ec *EmbedCache) Get(channelID, messageID string) (*CachedPost, bool)

func (*EmbedCache) Remove

func (ec *EmbedCache) Remove(channelID, messageID string) bool

func (*EmbedCache) Set

func (ec *EmbedCache) Set(userID, channelID, messageID string, parent bool, children ...*MessageInfo)

type MessageInfo

type MessageInfo struct {
	MessageID string
	ChannelID string
}

MessageInfo is a message/channel ID pair.

Jump to

Keyboard shortcuts

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