fix cache clear with regex and tests