diff --git a/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs b/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs
new file mode 100644
index 0000000000..51433e476e
--- /dev/null
+++ b/src/Umbraco.Core/PropertyEditors/UnPublishedContentPropertyCacheCompressionOptions.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Umbraco.Core.Models;
+
+namespace Umbraco.Core.PropertyEditors
+{
+ ///
+ /// Compress large, non published text properties
+ ///
+ internal class UnPublishedContentPropertyCacheCompressionOptions : IPropertyCacheCompressionOptions
+ {
+ public bool IsCompressed(IReadOnlyContentBase content, PropertyType propertyType, IDataEditor dataEditor, bool published)
+ {
+ if (published)
+ {
+ return false;
+ }
+ if (propertyType.SupportsPublishing && propertyType.ValueStorageType == ValueStorageType.Ntext)
+ {
+ //Only compress non published content that supports publishing and the property is text
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 931cef070f..f6a523441e 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -171,6 +171,7 @@
+
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs
index c6b214102b..4b3d7b20fa 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs
@@ -26,8 +26,16 @@ namespace Umbraco.Web.PublishedCache.NuCache
{
composition.RegisterUnique();
}
-
- composition.RegisterUnique();
+ var unPublishedContentCompression = ConfigurationManager.AppSettings[NuCacheSerializerComponent.Nucache_UnPublishedContentCompression_Key];
+ if ("MsgPack" == serializer && "true" == unPublishedContentCompression)
+ {
+ composition.RegisterUnique();
+ }
+ else
+ {
+ composition.RegisterUnique();
+ }
+
composition.RegisterUnique(factory => new ContentDataSerializer(new DictionaryOfPropertyDataSerializer()));
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheSerializerComponent.cs b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheSerializerComponent.cs
index a1d3ed2b12..c2d24b16ac 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheSerializerComponent.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheSerializerComponent.cs
@@ -16,6 +16,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
public class NuCacheSerializerComponent : IComponent
{
internal const string Nucache_Serializer_Key = "Umbraco.Web.PublishedCache.NuCache.Serializer";
+ internal const string Nucache_UnPublishedContentCompression_Key = "Umbraco.Web.PublishedCache.NuCache.CompressUnPublishedContent";
private const string JSON_SERIALIZER_VALUE = "JSON";
private readonly Lazy _service;
private readonly IKeyValueService _keyValueService;