Help us shape the future of Go! Take the 2026 Go Developer Survey

storage

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryReferenceStore

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

MemoryReferenceStore is an in-memory implementation of ReferenceStore.

func NewMemoryReferenceStore

func NewMemoryReferenceStore() *MemoryReferenceStore

NewMemoryReferenceStore creates an in-memory reference store.

func (*MemoryReferenceStore) Cleanup

func (s *MemoryReferenceStore) Cleanup(expireBefore time.Time)

func (*MemoryReferenceStore) Delete

func (s *MemoryReferenceStore) Delete(id string)

func (*MemoryReferenceStore) Get

func (*MemoryReferenceStore) Save

func (s *MemoryReferenceStore) Save(asset *ReferenceAsset) error

type RedisReferenceStore

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

RedisReferenceStore implements ReferenceStore using Redis.

func NewRedisReferenceStore

func NewRedisReferenceStore(client *redis.Client, keyPrefix string, ttl time.Duration, logger *zap.Logger) *RedisReferenceStore

NewRedisReferenceStore creates a Redis-backed reference store.

func (*RedisReferenceStore) Cleanup

func (s *RedisReferenceStore) Cleanup(expireBefore time.Time)

func (*RedisReferenceStore) Delete

func (s *RedisReferenceStore) Delete(id string)

func (*RedisReferenceStore) Get

func (*RedisReferenceStore) Save

func (s *RedisReferenceStore) Save(asset *ReferenceAsset) error

type ReferenceAsset

type ReferenceAsset struct {
	ID        string    `json:"id"`
	FileName  string    `json:"file_name"`
	MimeType  string    `json:"mime_type"`
	Size      int       `json:"size"`
	CreatedAt time.Time `json:"created_at"`
	Data      []byte    `json:"-"`
}

ReferenceAsset represents a stored multimodal reference (e.g. uploaded image).

type ReferenceStore

type ReferenceStore interface {
	Save(asset *ReferenceAsset) error
	Get(id string) (*ReferenceAsset, bool)
	Delete(id string)
	Cleanup(expireBefore time.Time)
}

ReferenceStore defines how multimodal reference images are persisted. Redis is the production backend; in-memory implementation is kept for tests.

Jump to

Keyboard shortcuts

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