Merged v9/dev into this branch
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
/// </summary>
|
||||
internal class DictionaryOfPropertyDataSerializer : SerializerBase, ISerializer<IDictionary<string, PropertyData[]>>, IDictionaryOfPropertyDataSerializer
|
||||
{
|
||||
private static readonly PropertyData[] Empty = Array.Empty<PropertyData>();
|
||||
public IDictionary<string, PropertyData[]> ReadFrom(Stream stream)
|
||||
{
|
||||
|
||||
@@ -26,6 +27,11 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.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];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Configuration;
|
||||
using CSharpTest.Net.Collections;
|
||||
using CSharpTest.Net.Serialization;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Exceptions;
|
||||
|
||||
namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
{
|
||||
@@ -54,9 +54,9 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
for (var i = blockSize; i != 1; i >>= 1)
|
||||
bit++;
|
||||
if (1 << bit != blockSize)
|
||||
throw new ConfigurationErrorsException($"Invalid block size value \"{blockSize}\": must be a power of two.");
|
||||
throw new ConfigurationException($"Invalid block size value \"{blockSize}\": must be a power of two.");
|
||||
if (blockSize < 512 || blockSize > 65536)
|
||||
throw new ConfigurationErrorsException($"Invalid block size value \"{blockSize}\": must be >= 512 and <= 65536.");
|
||||
throw new ConfigurationException($"Invalid block size value \"{blockSize}\": must be >= 512 and <= 65536.");
|
||||
|
||||
return blockSize;
|
||||
}
|
||||
|
||||
@@ -101,6 +101,10 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
using System;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Models.PublishedContent;
|
||||
using Umbraco.Cms.Core.PublishedCache;
|
||||
|
||||
namespace Umbraco.Cms.Infrastructure.PublishedCache
|
||||
{
|
||||
public class MemberCache : IPublishedMemberCache
|
||||
public class MemberCache : IPublishedMemberCache, IDisposable
|
||||
{
|
||||
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
private readonly IPublishedModelFactory _publishedModelFactory;
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
private readonly bool _previewDefault;
|
||||
|
||||
private bool _disposedValue;
|
||||
public MemberCache(
|
||||
bool previewDefault,
|
||||
PublishedContentTypeCache contentTypeCache,
|
||||
@@ -36,5 +37,28 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
|
||||
=> PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, _variationContextAccessor, _publishedModelFactory);
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_contentTypeCache.Dispose();
|
||||
}
|
||||
|
||||
_disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
Dispose(disposing: true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
|
||||
{
|
||||
ContentCache.Dispose();
|
||||
MediaCache.Dispose();
|
||||
MemberCache.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user