homedb

package
v5.28.3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCacheMaxSize = 1000

DefaultCacheMaxSize defines the maximum number of entries the cache can hold.

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(maxSize int) (*Cache, error)

NewCache creates and returns a new cache instance with the given max size.

func (*Cache) ComputeKey

func (c *Cache) ComputeKey(impersonatedUser string, sessionAuth *auth.Token) (string, error)

ComputeKey generates a cache key based on user impersonation and an optional session auth token.

func (*Cache) Get

func (c *Cache) Get(user string) (string, bool)

Get retrieves the home database for a given user, if it exists. It updates the `lastUsed` timestamp for the entry.

func (*Cache) IsEnabled

func (c *Cache) IsEnabled() bool

IsEnabled checks whether the cache is enabled.

func (*Cache) Set

func (c *Cache) Set(user string, database string)

Set adds or updates an entry in the cache. If the cache exceeds its max size, it prunes the least recently used entries.

func (*Cache) SetEnabled

func (c *Cache) SetEnabled(enabled bool)

SetEnabled enables or disables the cache.

Jump to

Keyboard shortcuts

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