Documentation ¶
Index ¶
- type Cache
- type MemCache
- func (cache *MemCache) Clear()
- func (cache *MemCache) Get(clientID, fingerprint uint64, maxAge time.Time) *model.Session
- func (cache *MemCache) NewMutex(uint64, uint64) sync.Locker
- func (cache *MemCache) Put(clientID, fingerprint uint64, session *model.Session)
- func (cache *MemCache) Sessions() map[string]model.Session
- type RedisCache
- type RedisMutex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Get returns a session for given client ID, fingerprint, and offset. Get(uint64, uint64, time.Time) *model.Session // Put stores a session for given client ID and fingerprint. Put(uint64, uint64, *model.Session) // Clear clears the cache. Clear() // NewMutex creates a new mutex for given client ID and fingerprint. NewMutex(uint64, uint64) sync.Locker }
Cache is a session cache.
type MemCache ¶
type MemCache struct {
// contains filtered or unexported fields
}
MemCache caches sessions in memory. This does only make sense for non-distributed systems (tracking on a single machine/app).
func NewMemCache ¶
NewMemCache creates a new cache for given client and maximum size.
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache caches sessions in Redis.
func NewRedisCache ¶
func NewRedisCache(maxAge time.Duration, log *slog.Logger, redisOptions *redis.Options) *RedisCache
NewRedisCache creates a new cache for given maximum age and redis connection.
type RedisMutex ¶
type RedisMutex struct {
// contains filtered or unexported fields
}
RedisMutex wraps a redis mutex.
func (*RedisMutex) Lock ¶
func (m *RedisMutex) Lock()
func (*RedisMutex) Unlock ¶
func (m *RedisMutex) Unlock()
Click to show internal directories.
Click to hide internal directories.