Documentation
¶
Index ¶
- func KeyMetadata(sessionID string) string
- type Cache
- func (c *Cache) GetMetadata(ctx context.Context, sessionID string) (*CachedMetadataRecord, bool)
- func (c *Cache) InvalidateBulkMetadata(ctx context.Context, sessionIDs []string)
- func (c *Cache) InvalidateMetadata(ctx context.Context, sessionID string)
- func (c *Cache) SetMetadata(ctx context.Context, rec *CachedMetadataRecord)
- type CachedDeviceRecord
- type CachedMetadataRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyMetadata ¶
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 ¶
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 ¶
GetMetadata returns cached session metadata, if present.
func (*Cache) InvalidateBulkMetadata ¶
InvalidateBulkMetadata removes cached metadata for multiple session IDs.
func (*Cache) InvalidateMetadata ¶
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.