Commit 20c57641 authored by Akshay Bharambe's avatar Akshay Bharambe
Browse files

Add: Init cache related func. with new Setup

parent 2d2a7434
Branches
Tags
2 merge requests!210Staging mepdeployment05072020,!203Add: New cache initialization to make v2 independent of CoreSLS
Showing with 18 additions and 0 deletions
......@@ -52,6 +52,15 @@ func InitUserSessionCache(chacheType int) {
store = cachemdl.GetCacheInstance(&cacheConfig)
}
// Init initializes sessions with provided cache. Subsequent calls will not have any effect after fist initialization.
func Init(cache cachemdl.Cacher) {
if store != nil {
return
}
store = cache
}
// Set stores the sessions for provided userId. Session is appended to the list. It does not check if the same session exists or not.
func Set(userId string, s ...Session) {
i, ok := store.Get(userId)
......
......@@ -49,6 +49,15 @@ func InitSessionManagerCache(chacheType int) {
store = cachemdl.GetCacheInstance(&cacheConfig)
}
// Init initializes session manager with provided cache. Subsequent calls will not have any effect after fist initialization.
func Init(cache cachemdl.Cacher) {
if store != nil {
return
}
store = cache
}
// NewEntry prepares the object required to store data in session.
//
// The `exp` field interprets time in seconds. Ex. For 5 seconds, set `5`
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment