Refresh operations in memory devices with an internal cache or data buffer