store

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// Data the real user data
	Data []byte
	// ExpireTime the expiration time of the data
	ExpireTime *time.Time
}

Data the store data object

func NewData

func NewData(data []byte, expiration time.Duration) *Data

NewData create a store data object

func (*Data) IsExpired

func (d *Data) IsExpired() bool

IsExpired check if the data is expired or not

type Store

type Store interface {
	// Get get cache data
	Get(k string) *Data
	// Set set cache data with expiration time
	Set(k string, data []byte, expiration time.Duration) error
	// Remove remove the cache data
	Remove(k string) error
	// Close close the store component
	Close() error
}

Store the cache store interface, it must be concurrency safe

Jump to

Keyboard shortcuts

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