added the option to do periodical redis persistence