diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs index 80d8488495..7ddfc8e6ea 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs @@ -30,6 +30,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource //btree. return tree; + } private static int GetBlockSize() diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs index 8b02946fc2..0cd095d77f 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs @@ -57,11 +57,18 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource protected object ReadObject(Stream stream) => ReadObject(PrimitiveSerializer.Char.ReadFrom(stream), stream); + /// + /// Reads in a value based on its char type + /// + /// + /// + /// + /// + /// This will incur boxing because the result is an object but in most cases the value will be a struct. + /// When the type is known use the specific methods like instead + /// protected object ReadObject(char type, Stream stream) { - // NOTE: This method is only called when reading property data, some boxing may occur but all other reads for structs are - // done with ReadStruct to reduce all boxing. - switch (type) { case PrefixNull: @@ -93,11 +100,17 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource } } + /// + /// Writes a value to the stream ensuring it's char type is prefixed to the value for reading later + /// + /// + /// + /// + /// This method will incur boxing if the value is a struct. When the type is known use the + /// to write the value directly. + /// protected void WriteObject(object value, Stream stream) { - // NOTE: This method is only currently used to write 'string' information, all other writes are done directly with the PrimitiveSerializer - // so no boxing occurs. Though potentially we should write everything via this class just like we do for reads. - if (value == null) { PrimitiveSerializer.Char.WriteTo(PrefixNull, stream);