db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: MIT Imports: 2 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
}

func NewCache

func NewCache(ttl time.Duration) *Cache

Create a new Cache struct and initialize it with the given TTL duration

func (*Cache) Add

func (c *Cache) Add(addr string, message Message)

Add Message to cache

func (*Cache) GetByAddr

func (c *Cache) GetByAddr(addr string) []Message

GetByAddr Return all []Message with matching Message.To

func (*Cache) GetById

func (c *Cache) GetById(id string) (Message, bool)

GetById Return Message with matching Message.ID

func (*Cache) Init

func (c *Cache) Init(ttl time.Duration)

Initialize the Cache for given TTL

type Message

type Message struct {
	ID      string
	To      string
	From    string
	Date    string
	Subject string
	Text    string
	HTML    string
}

Jump to

Keyboard shortcuts

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