Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
jodydonetti committed May 19, 2024
1 parent ce1c02a commit ab865a2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson;
public class FusionCacheNewtonsoftJsonSerializer
: IFusionCacheSerializer
{
private static Encoding _encoding = Encoding.UTF8;

/// <summary>
/// Create a new instance of a <see cref="FusionCacheNewtonsoftJsonSerializer"/> object.
/// </summary>
Expand All @@ -24,13 +26,13 @@ public FusionCacheNewtonsoftJsonSerializer(JsonSerializerSettings? settings = nu
/// <inheritdoc />
public byte[] Serialize<T>(T? obj)
{
return Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(obj, _settings));
return _encoding.GetBytes(JsonConvert.SerializeObject(obj, _settings));
}

/// <inheritdoc />
public T? Deserialize<T>(byte[] data)
{
return JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(data), _settings);
return JsonConvert.DeserializeObject<T>(_encoding.GetString(data), _settings);
}

/// <inheritdoc />
Expand Down

0 comments on commit ab865a2

Please sign in to comment.