serialize cache writing