add flush function to RedObject