[TASK] Move cache clearing code to data handler hook