Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Get = func(key string) (Cache, bool) { log.Debug("get value from cache") cachedItem, exists := SessionCache.Get(key) var cached Cache if exists { cached = cachedItem.(Cache) } log.Debugf("cache response, exists=%t, cached=%v", exists, cached) return cached, exists }
Get returns a cache item from the session storage at key
var NewSessionKey = func() string { log.Debug("generating new session key") // Generate a new key until one is generated, which doesn't already exist var sessionKey string exists := true for exists { key := uuid.New().String() sessionKey = key _, exists = Get(key) } log.Debug("new session key generated") return sessionKey }
NewSessionKey generates a session key used for storing dataset permissions, and checks that it doesn't already exist
var SessionCache *ristretto.Cache
SessionCache is the in-memory storage holding session keys and interfaces containing cached data
Functions ¶
func InitialiseSessionCache ¶
InitialiseSessionCache creates a cache manager that stores keys and values in memory
Types ¶
type Cache ¶ added in v1.10.1
type Cache struct {
Datasets []string
}
Cache stores the dataset permissions and information whether this information has already been checked or not. This information can then be used to skip the time-costly authentication middleware Cache==nil, session doesn't exist Cache.Datasets==nil, session exists, user has no permissions (this case is not used in middleware.go) Cache.Datasets==[]string{...}, session exists, user has permissions