sessions

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectSessionsCache

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

ObjectSessionsCache caches object session tokens based on their hashes, both v1 and v2 versions. Caches are LRU, there is no garanty a put token will be available later.

func NewObjectSessionsCache

func NewObjectSessionsCache(cacheSize int) *ObjectSessionsCache

NewObjectSessionsCache creates ObjectSessionsCache with a provided size. Caches for v1 and v2 tokens are independent. Size must be positive.

func (*ObjectSessionsCache) AuthenticateTokenV1

func (ch *ObjectSessionsCache) AuthenticateTokenV1(tokenKey [sha256.Size]byte, authOnMiss func() (session.Object, error)) (session.Object, error)

AuthenticateTokenV1 checks whether v1 token was cached as a correctly signed one. On cache miss, authOnMiss is called and its result is saved for future calls with the same tokenKey. tokenKey must be the same for the same token for cache to work properly.

func (*ObjectSessionsCache) AuthenticateTokenV2

func (ch *ObjectSessionsCache) AuthenticateTokenV2(tokenKey [sha256.Size]byte, authOnMiss func() (sessionv2.Token, error)) (sessionv2.Token, error)

AuthenticateTokenV2 works the same as ObjectSessionsCache.AuthenticateTokenV1 but for v2 session tokens.

func (*ObjectSessionsCache) ResetCache

func (ch *ObjectSessionsCache) ResetCache()

ResetCache resets all cached tokens.

Jump to

Keyboard shortcuts

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