cache

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyMetadata

func KeyMetadata(sessionID string) string

KeyMetadata returns the namespaced cache key for session metadata. Format: gomodularauth:multisession:meta:<sessionID>

Types

type Cache

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

Cache wraps the Core cache adapter with semantic multisession metadata operations.

func New

func New(c corecache.Cache, ttl time.Duration) *Cache

New constructs a semantic Cache wrapper around an optional core Cache. If c is nil, Cache gracefully acts as a no-op layer.

func (*Cache) GetMetadata

func (c *Cache) GetMetadata(ctx context.Context, sessionID string) (*CachedMetadataRecord, bool)

GetMetadata returns cached session metadata, if present.

func (*Cache) InvalidateBulkMetadata

func (c *Cache) InvalidateBulkMetadata(ctx context.Context, sessionIDs []string)

InvalidateBulkMetadata removes cached metadata for multiple session IDs.

func (*Cache) InvalidateMetadata

func (c *Cache) InvalidateMetadata(ctx context.Context, sessionID string)

InvalidateMetadata removes cached metadata for the given session ID.

func (*Cache) SetMetadata

func (c *Cache) SetMetadata(ctx context.Context, rec *CachedMetadataRecord)

SetMetadata stores the session metadata in cache.

type CachedDeviceRecord

type CachedDeviceRecord struct {
	Name      string `json:"name,omitempty"`
	Type      string `json:"type,omitempty"`
	OS        string `json:"os,omitempty"`
	Browser   string `json:"browser,omitempty"`
	IPAddress string `json:"ip_address,omitempty"`
}

CachedDeviceRecord contains persistent device identification details for caching.

type CachedMetadataRecord

type CachedMetadataRecord struct {
	SessionID string             `json:"session_id"`
	UserID    string             `json:"user_id"`
	Device    CachedDeviceRecord `json:"device"`
	Custom    map[string]string  `json:"custom,omitempty"`
	CreatedAt time.Time          `json:"created_at"`
	UpdatedAt time.Time          `json:"updated_at"`
}

CachedMetadataRecord is the cached representation of session metadata.

Jump to

Keyboard shortcuts

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