Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Online ¶
type Online struct {
// contains filtered or unexported fields
}
Online tracks active users/sessions using a TTL-based cache. It maintains a count of online entities based on configurable key generation.
func NewOnline ¶
func NewOnline() *Online
NewOnline creates a new online tracking instance with an in-memory cache.
func (*Online) Middleware ¶
func (l *Online) Middleware(keygen func(ctx httpx.Context) string, ttl time.Duration) httpx.Middleware
Middleware creates a Gin middleware that tracks online presence. It extracts a key from the request context and updates the online status with the specified TTL.
func (*Online) OnlineCount ¶
OnlineCount returns the current number of online entities. This count reflects entries that have not yet expired from the cache.
Click to show internal directories.
Click to hide internal directories.