move clear cache to beforeSave