storage

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package storage session存储器

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

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

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

func (MemoryStorage) Get

func (s MemoryStorage) Get(ctx context.Context, key string) string

func (MemoryStorage) HasExpired

func (s MemoryStorage) HasExpired(ctx context.Context, key string) bool

func (MemoryStorage) Set

func (s MemoryStorage) Set(ctx context.Context, key string, val string, ttl time.Duration) error

type Storage

type Storage interface {
	// Get 获取Value
	Get(ctx context.Context, key string) string

	// Set 设置Value,包含TTL
	Set(ctx context.Context, key, val string, ttl time.Duration) error

	// HasExpired 检测是否过期
	HasExpired(ctx context.Context, key string) bool
}

Jump to

Keyboard shortcuts

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