cache

package
v0.12.78 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStats

type CacheStats struct {
	Total   int
	Active  int
	Expired int
	TTL     time.Duration
	Hits    uint64
	Misses  uint64
}

CacheStats represents cache statistics

type UserCache

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

UserCache provides in-memory caching for user data with TTL support

func NewUserCache

func NewUserCache(ttl time.Duration) *UserCache

NewUserCache creates a new user cache with the specified TTL

func (*UserCache) Clear

func (c *UserCache) Clear()

Clear removes all users from cache

func (*UserCache) Delete

func (c *UserCache) Delete(realm, email string)

Delete removes a user from cache

func (*UserCache) Get

func (c *UserCache) Get(realm, email string) *graph.User

Get retrieves a user from cache by realm and email Returns nil if not found or expired

func (*UserCache) GetMany

func (c *UserCache) GetMany(realm string, emails []string) (map[string]*graph.User, []string)

GetMany retrieves multiple users from cache by realm and emails Returns a map of found users and a slice of missing emails

func (*UserCache) Set

func (c *UserCache) Set(realm, email string, user *graph.User)

Set stores a user in cache with TTL

func (*UserCache) SetMany

func (c *UserCache) SetMany(realm string, users map[string]*graph.User)

SetMany stores multiple users in cache with TTL

func (*UserCache) Size

func (c *UserCache) Size() int

Size returns the number of cached users

func (*UserCache) Stats

func (c *UserCache) Stats() CacheStats

Stats returns cache statistics

Jump to

Keyboard shortcuts

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