In my opinion, databases should be for data, nothing more. Of course there are exceptions, but I try to stick to this as a general rule.
Now, in your case, it would make sense to allow the text to be saved in the database as it was entered. So, if you use a bbcode for "code," it might look like this:
Take a look at the [code]foo[/code] command.
Instead of replacing your bbcode and putting it in the database, I suggest you store it as is, then format it as you are displaying it. That way, if you decide later to change how code is displayed, ALL [code] will be formatted in the new way.
The overhead when doing your conversions will most likely not be too great, so IMHO caching really wouldn't be necessary except for the most extreme cases.