usercache

package
v0.0.0-...-732ec5d Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryUserCache

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

MemoryUserCache is a memory-based nickname cache

func NewInMemory

func NewInMemory() (*MemoryUserCache, error)

NewInMemory returns a new MemoryUserCache

func (*MemoryUserCache) CacheUser

func (c *MemoryUserCache) CacheUser(_ context.Context, user auth.User) error

CacheUser saves user information in cache

func (*MemoryUserCache) GetOrFetchUser

func (c *MemoryUserCache) GetOrFetchUser(ctxCtx context.Context, address string) (auth.User, error)

GetOrFetchUser loads user info from cache, falling back to the database if necessary

type UserCache

type UserCache interface {
	GetOrFetchUser(ctx context.Context, address string) (auth.User, error)
	CacheUser(ctx context.Context, user auth.User) error
}

UserCache caches public user information

Jump to

Keyboard shortcuts

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