Ejemplo n.º 1
0
func _ensureDbIndexes(session *mgo.Session) {

	sessions := session.DB(_cfg.Database).C(SESSIONS_COLLECTION)
	expireSessionsIndex := mgo.Index{}
	//TODO: should read from the sessions config
	//or be invoked from the bootstrapper
	expireSessionsIndex.ExpireAfter = 1 * time.Hour
	expireSessionsIndex.Key = []string{"expiry"}
	sessions.EnsureIndex(expireSessionsIndex)
}