Accelerator cavities as a probe of millicharged particles