[PR #417] Cleanup StringBuilderCache #1010

Open
opened 2026-01-29 14:48:30 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/xoofx/markdig/pull/417

State: closed
Merged: Yes


StringBuilderCache used to inherit from DefaultObjectCache<StringBuilder>, and instances were being passed around.

However, nobody was actually using those instances, with one exception: CodeInlineParser.

All other code uses StringBuilderCache.Local(). As it turns out, there is actually no reason why CodeInlineParser could not do the same.

This PR changes StringBuilderCache to be a static class, no longer inheriting from DefaultObjectCache<StringBuilder>. All references to instances are removed. CodeInlineParser was modified to use StringBuilderCache.Local() as well.

It goes without saying that this is a breaking change, as the class and most of the instance references were public.

**Original Pull Request:** https://github.com/xoofx/markdig/pull/417 **State:** closed **Merged:** Yes --- `StringBuilderCache` used to inherit from `DefaultObjectCache<StringBuilder>`, and instances were being passed around. However, nobody was actually using those instances, with one exception: `CodeInlineParser`. All other code uses `StringBuilderCache.Local()`. As it turns out, there is actually no reason why `CodeInlineParser` could not do the same. This PR changes `StringBuilderCache` to be a `static class`, no longer inheriting from `DefaultObjectCache<StringBuilder>`. All references to instances are removed. `CodeInlineParser` was modified to use `StringBuilderCache.Local()` as well. It goes without saying that this is a breaking change, as the class and most of the instance references were public.
claunia added the pull-request label 2026-01-29 14:48:30 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#1010