added flush option to set()