Where do I store classes and ids that the user inputs in my custom module?
Of your three options, 2 would be a huge burden to a site in performance, and 3 will likely be a security issue. So I'd go with 1.

For reference, see the Block Class module.