Example #1
0
func retentionHandler(w http.ResponseWriter, redis *models.RedisLogger, form retentionForm) {
	if ok, err := checkToken(redis, form.Token); !ok {
		writeResponse(w, err)
		return
	}

	date := time.Now()
	if form.Date > 0 {
		date = time.Unix(form.Date, 0)
	}
	r := redis.Retention(date)
	writeResponse(w, map[string]interface{}{"retention": r})
}