1
- using System . Text ;
1
+ using System . Text ;
2
2
using K4os . Compression . LZ4 ;
3
3
using MessagePack ;
4
4
using MessagePack . Resolvers ;
8
8
namespace Umbraco . Cms . Infrastructure . HybridCache . Serialization ;
9
9
10
10
/// <summary>
11
- /// Serializes/Deserializes <see cref="ContentCacheDataModel" /> document to the SQL Database as bytes using
12
- /// MessagePack
11
+ /// Serializes/deserializes <see cref="ContentCacheDataModel" /> documents to the SQL Database as bytes using
12
+ /// MessagePack.
13
13
/// </summary>
14
14
internal sealed class MsgPackContentNestedDataSerializer : IContentCacheDataSerializer
15
15
{
16
16
private readonly MessagePackSerializerOptions _options ;
17
17
private readonly IPropertyCacheCompression _propertyOptions ;
18
18
19
+ /// <summary>
20
+ /// Initializes a new instance of the <see cref="MsgPackContentNestedDataSerializer"/> class.
21
+ /// </summary>
19
22
public MsgPackContentNestedDataSerializer ( IPropertyCacheCompression propertyOptions )
20
23
{
21
24
_propertyOptions = propertyOptions ?? throw new ArgumentNullException ( nameof ( propertyOptions ) ) ;
@@ -40,6 +43,7 @@ public MsgPackContentNestedDataSerializer(IPropertyCacheCompression propertyOpti
40
43
. WithSecurity ( MessagePackSecurity . UntrustedData ) ;
41
44
}
42
45
46
+ /// <inheritdoc/>
43
47
public ContentCacheDataModel ? Deserialize ( IReadOnlyContentBase content , string ? stringData , byte [ ] ? byteData , bool published )
44
48
{
45
49
if ( byteData != null )
@@ -62,18 +66,18 @@ public MsgPackContentNestedDataSerializer(IPropertyCacheCompression propertyOpti
62
66
return null ;
63
67
}
64
68
69
+ /// <inheritdoc/>
65
70
public ContentCacheDataSerializationResult Serialize ( IReadOnlyContentBase content , ContentCacheDataModel model , bool published )
66
71
{
67
72
Compress ( content , model , published ) ;
68
73
var bytes = MessagePackSerializer . Serialize ( model , _options ) ;
69
74
return new ContentCacheDataSerializationResult ( null , bytes ) ;
70
75
}
71
76
72
- public string ToJson ( byte [ ] bin )
73
- {
74
- var json = MessagePackSerializer . ConvertToJson ( bin , _options ) ;
75
- return json ;
76
- }
77
+ /// <summary>
78
+ /// Converts the binary MessagePack data to a JSON string representation.
79
+ /// </summary>
80
+ public string ToJson ( byte [ ] bin ) => MessagePackSerializer . ConvertToJson ( bin , _options ) ;
77
81
78
82
/// <summary>
79
83
/// Used during serialization to compress properties
0 commit comments