cache

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageCache

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

func NewImageCache

func NewImageCache() (*ImageCache, error)

NewImageCache creates a new image cache instance

func (*ImageCache) Close

func (ic *ImageCache) Close() error

Close closes the database connection and prepared statements

func (*ImageCache) GetAvatarFilePath

func (ic *ImageCache) GetAvatarFilePath(jid string) (string, error)

GetAvatarFilePath returns the file path for a cached avatar by JID

func (*ImageCache) GetImageByMessageID

func (ic *ImageCache) GetImageByMessageID(messageID string) (*ImageMeta, error)

GetImageByMessageID retrieves image metadata by message ID

func (*ImageCache) GetImageFilePath

func (ic *ImageCache) GetImageFilePath(messageID string) (string, error)

GetImageFilePath returns the file path for a cached image by message ID

func (*ImageCache) GetImagesByMessageIDs

func (ic *ImageCache) GetImagesByMessageIDs(messageIDs []string) (map[string]*ImageMeta, error)

GetImagesByMessageIDs retrieves multiple image metadata by message IDs (batch)

func (*ImageCache) ReadAvatarByJID

func (ic *ImageCache) ReadAvatarByJID(jid string) ([]byte, string, error)

ReadAvatarByJID reads an avatar image by JID

func (*ImageCache) ReadImageByMessageID

func (ic *ImageCache) ReadImageByMessageID(messageID string) ([]byte, string, error)

ReadImageByMessageID reads an image by message ID

func (*ImageCache) SaveAvatar

func (ic *ImageCache) SaveAvatar(jid string, data []byte, mime string) (string, error)

SaveAvatar saves an avatar image to cache using JID as the key

func (*ImageCache) SaveImage

func (ic *ImageCache) SaveImage(messageID string, data []byte, mime string, width, height int) (string, error)

SaveImage saves an image to cache and creates an index entry

type ImageMeta

type ImageMeta struct {
	MessageID string
	SHA256    string
	Mime      string
	Width     int
	Height    int
	CreatedAt int64
}

Jump to

Keyboard shortcuts

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