Documentation
¶
Index ¶
- func GetSessionCooldownBySessionId(rdb *redis.Client, sessionId string) (int, error)
- func RedisLoad(rdb *redis.Client, entity string, key string, rec interface{}) error
- func RedisStore(rdb *redis.Client, entity string, key string, rec interface{}) error
- func StoreSession(rdb *redis.Client, session *SessionData) error
- func StoreUser(rdb *redis.Client, user *UserData) error
- func TestAndUpdateSessionCooldown(rdb *redis.Client, appConfig *AppConfig, sessionId string) (error, bool)
- type AppConfig
- type SessionData
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedisStore ¶
Store data into redis.
func StoreSession ¶
func StoreSession(rdb *redis.Client, session *SessionData) error
func TestAndUpdateSessionCooldown ¶
func TestAndUpdateSessionCooldown(rdb *redis.Client, appConfig *AppConfig, sessionId string) (error, bool)
Check cooldown for user session. Return true if there was cooldown info (user made request less than `CooldownSeconds' seconds ago). Otherwise return false AND add cooldown info. Should be atomic.
Types ¶
type AppConfig ¶
type AppConfig struct { CanvasRows int CanvasCols int CooldownSeconds int PaletteColors []string InitialImage string RedisAddress string RedisPassword string RedisDatabase int AllowedOrigins string WebSocketAppAddresses []string }
func MustReadAppConfig ¶
Read configuration file. Panic on error
type SessionData ¶
func GetSessionBySessionId ¶
func GetSessionBySessionId(rdb *redis.Client, sessionId string) (*SessionData, error)
Click to show internal directories.
Click to hide internal directories.