FYI:Alan has provided a slightly more polished helper and I have accepted it into the main Squid sources. You will find it being built by the next 3.HEAD snapshots under the name "storeid_file_rewrite".
Please send further additions or alterations to the helper itself through the regular code auditing process: mail to squid-dev list a unified diff patch against the 3.HEAD code with "[PATCH]" in the email subject
and a descriptive commit message in the email text. Cheers Amos