diff --git a/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs b/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs index 68036dab4b..58ecd0cd39 100644 --- a/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/ContentTypeDto.cs @@ -9,6 +9,7 @@ namespace Umbraco.Core.Persistence.Dtos internal class ContentTypeDto { public const string TableName = Constants.DatabaseSchema.Tables.ContentType; + private string _alias; [Column("pk")] [PrimaryKeyColumn(IdentitySeed = 700)] @@ -21,7 +22,7 @@ namespace Umbraco.Core.Persistence.Dtos [Column("alias")] [NullSetting(NullSetting = NullSettings.Null)] - public string Alias { get; set; } + public string Alias { get => _alias; set => _alias = value == null ? null : string.Intern(value); } [Column("icon")] [Index(IndexTypes.NonClustered)] diff --git a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs index f22e4453f4..d5ce28d3b5 100644 --- a/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/PropertyTypeDto.cs @@ -10,6 +10,8 @@ namespace Umbraco.Core.Persistence.Dtos [ExplicitColumns] internal class PropertyTypeDto { + private string _alias; + [Column("id")] [PrimaryKeyColumn(IdentitySeed = 100)] public int Id { get; set; } @@ -29,7 +31,7 @@ namespace Umbraco.Core.Persistence.Dtos [Index(IndexTypes.NonClustered, Name = "IX_cmsPropertyTypeAlias")] [Column("Alias")] - public string Alias { get; set; } + public string Alias { get => _alias; set => _alias = value == null ? null : string.Intern(value); } [Column("Name")] [NullSetting(NullSetting = NullSettings.Null)] diff --git a/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs b/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs index ece25479cc..954390ca1e 100644 --- a/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs +++ b/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs @@ -14,6 +14,11 @@ namespace Umbraco.Core.PropertyEditors //Only compress non published content that supports publishing and the property is text return true; } + if (propertyType.ValueStorageType == ValueStorageType.Integer && Umbraco.Core.Constants.PropertyEditors.Aliases.Boolean.Equals(dataEditor.Alias)) + { + //Compress boolean values from int to bool + return true; + } return false; } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs index 304fc6def0..f9a44adab1 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfPropertyDataSerializer.cs @@ -11,6 +11,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource /// internal class DictionaryOfPropertyDataSerializer : SerializerBase, ISerializer>, IDictionaryOfPropertyDataSerializer { + private static readonly PropertyData[] Empty = Array.Empty(); public IDictionary ReadFrom(Stream stream) { // read properties count @@ -25,6 +26,11 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource // read values count var vcount = PrimitiveSerializer.Int32.ReadFrom(stream); + if(vcount == 0) + { + dict[key] = Empty; + continue; + } // create pdata and add to the dictionary var pdatas = new PropertyData[vcount]; diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs index f1400382e6..bfbe1d8818 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MsgPackContentNestedDataSerializer.cs @@ -101,6 +101,10 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource { property.Value = LZ4Pickler.Pickle(Encoding.UTF8.GetBytes((string)property.Value), LZ4Level.L00_FAST); } + foreach (var property in propertyAliasToData.Value.Where(x => x.Value != null && x.Value is int intVal)) + { + property.Value = Convert.ToBoolean((int)property.Value); + } } } }