GetSessionStore create new session store with store config
(config *StoreConfig)
| 55 | |
| 56 | // GetSessionStore create new session store with store config |
| 57 | func GetSessionStore(config *StoreConfig) SessionStore { |
| 58 | switch config.StoreName { |
| 59 | case SessionMode_Runtime: |
| 60 | return NewRuntimeStore(config) |
| 61 | case SessionMode_Redis: |
| 62 | store, err := NewRedisStore(config) |
| 63 | if err != nil { |
| 64 | panic(fmt.Sprintf("redis session [%v] ping error -> %v", config.StoreName, err.Error())) |
| 65 | } else { |
| 66 | return store |
| 67 | } |
| 68 | default: |
| 69 | panic("not support session store -> " + config.StoreName) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // NewDefaultRuntimeConfig create new store with default config and use runtime store |
| 74 | func NewDefaultRuntimeConfig() *StoreConfig { |
no test coverage detected