write state to redis