Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.24.0 #183

Merged
merged 115 commits into from
Nov 12, 2023
Merged
Changes from 1 commit
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
eff34bd
New shared abstract base class
jodydonetti Aug 13, 2023
1f40f77
Better MemoryBackplane
jodydonetti Aug 13, 2023
3d9d376
Xml docs
jodydonetti Aug 13, 2023
1817080
Better backpressure handling for backplane + tests
jodydonetti Aug 19, 2023
d42d6be
Make BackplaneAutoRecoveryReconnectDelay obsolete and use BackplaneAu…
jodydonetti Aug 19, 2023
bfdbe66
Rename BackplaneAutoRecoveryBackpressureDelay to a more generic Backp…
jodydonetti Aug 19, 2023
7706a25
Minor
jodydonetti Aug 19, 2023
f6ddbba
Minor
jodydonetti Aug 22, 2023
13a2623
Bug fix for #168
jodydonetti Aug 22, 2023
28fccaa
Add support for inspecting a value being evicted (to support disposab…
jodydonetti Sep 1, 2023
2ea1221
Superior backplane auto-recovery handling, like, new super dooper ver…
jodydonetti Sep 3, 2023
d570a7f
Make workload scenarion fully interactive + add chaos-related functions
jodydonetti Sep 3, 2023
2ad7ba6
Better backplane tests
jodydonetti Sep 3, 2023
17b3f8a
Add support for testing ReThrowBackplaneExceptions when duplicating
jodydonetti Sep 3, 2023
a129145
Minor
jodydonetti Sep 3, 2023
876af9c
Docs
jodydonetti Sep 3, 2023
2105d31
Benchmarks update
jodydonetti Sep 3, 2023
f19540b
Dependencies update
jodydonetti Sep 3, 2023
4e0d64d
Minor
jodydonetti Sep 3, 2023
48b97ba
Minor
jodydonetti Sep 3, 2023
c3390d7
v0.24.0-preview1
jodydonetti Sep 3, 2023
2ec8a5f
Fix links
jodydonetti Sep 3, 2023
4c0cf63
Add cancellation support to chaos components
jodydonetti Sep 9, 2023
a7219a2
Minor
jodydonetti Sep 16, 2023
e0c4727
Add DistributedCacheWireFormatVersion and DistributedCacheWireFormatS…
jodydonetti Sep 16, 2023
35a5d54
Add execution benchmarks
jodydonetti Sep 16, 2023
b46154f
Update packages
jodydonetti Sep 16, 2023
6b17393
A lot of internal refactoring
jodydonetti Sep 16, 2023
ebfa99a
Add snapshot testing for v0.23.0
jodydonetti Sep 23, 2023
8917e09
Add distributed cache background execution tests
jodydonetti Sep 23, 2023
b645327
Minor
jodydonetti Sep 30, 2023
6bdb9a8
Add SetAlwaysDelay(...) overload
jodydonetti Sep 30, 2023
361f7de
Workload + tests
jodydonetti Oct 1, 2023
93e7084
Minor
jodydonetti Oct 8, 2023
be9cb2c
Minor
jodydonetti Oct 8, 2023
a9652b6
Mega refactoring of the entire distributed management
jodydonetti Oct 8, 2023
8c3aee0
Minor
jodydonetti Oct 8, 2023
045e233
Backplane auto-recovery is now Auto-Recovery
jodydonetti Oct 8, 2023
f42865a
Minor
jodydonetti Oct 8, 2023
5ea78c4
Minor
jodydonetti Oct 8, 2023
db72df5
General cleanup
jodydonetti Oct 8, 2023
5246515
Add Timestamp to AutoRecoveryItem + minor action fix
jodydonetti Oct 8, 2023
39d2940
Major refactoring, cleanup, speed up and more edge cases handled
jodydonetti Oct 15, 2023
54a837c
More cleanup
jodydonetti Oct 29, 2023
b383e7d
Add support for splitted background run of background operations (dis…
jodydonetti Oct 29, 2023
9a73595
Better tests
jodydonetti Oct 29, 2023
d489c59
Remove sentinel
jodydonetti Oct 29, 2023
10b7261
Small fix
jodydonetti Oct 29, 2023
8788e84
Minor
jodydonetti Oct 29, 2023
588532f
Cleanup
jodydonetti Oct 29, 2023
f1dc5fa
Workload: add random updates
jodydonetti Oct 29, 2023
ac57749
Add ConnectionMultiplexerFactory to RedisBackplane
jodydonetti Oct 29, 2023
4ca1698
Minor
jodydonetti Oct 29, 2023
a24ad25
Minor xml docs
jodydonetti Oct 30, 2023
b1a8059
Minor
jodydonetti Oct 31, 2023
c6d3fbd
Minor
jodydonetti Oct 31, 2023
30c0c85
Add EditorBrowsable attribute
jodydonetti Nov 1, 2023
311ad63
Add ReThrowOriginalExceptions and some specific exceptions for serial…
jodydonetti Nov 1, 2023
8a9ceaf
Add EditorBrowsable attribute + make some of the classes sealed for b…
jodydonetti Nov 1, 2023
5df9c75
Add EditorBrowsable attribute
jodydonetti Nov 1, 2023
cdd6fea
Better tests
jodydonetti Nov 1, 2023
77c982c
File-scoped namespaces
jodydonetti Nov 1, 2023
6617822
Split auto-recovery code into the new AutoRecoveryService
jodydonetti Nov 1, 2023
7d098f2
Better tests
jodydonetti Nov 1, 2023
c8f35f4
Better auto-recovery log levels + some refactoring
jodydonetti Nov 1, 2023
3a99df2
Minor
jodydonetti Nov 1, 2023
c6a595c
Better tests
jodydonetti Nov 1, 2023
2b9d6b2
Minor
jodydonetti Nov 1, 2023
853de2f
Docs
jodydonetti Nov 1, 2023
1ca05c4
Docs
jodydonetti Nov 1, 2023
4c73ebe
Add backplane wire format modifier for
jodydonetti Nov 1, 2023
f2fbe9d
Better tests
jodydonetti Nov 1, 2023
e0d4715
Simulator stuff
jodydonetti Nov 1, 2023
9fadcd7
More sealed stuff
jodydonetti Nov 4, 2023
095a5fb
Minor
jodydonetti Nov 4, 2023
16c5815
Minor
jodydonetti Nov 4, 2023
190d5b1
Minor
jodydonetti Nov 4, 2023
8b32f8f
Minor
jodydonetti Nov 8, 2023
07f415a
Better tests
jodydonetti Nov 8, 2023
a76a75e
Better simulator UI
jodydonetti Nov 11, 2023
70ae7c3
Docs
jodydonetti Nov 11, 2023
d4a6ba2
Small memory optimization
jodydonetti Nov 11, 2023
6e186d6
Minor
jodydonetti Nov 11, 2023
79cad53
Better tests
jodydonetti Nov 11, 2023
bf196a9
Add FromByteArray/ToByteArray static methods to BackplaneMessage
jodydonetti Nov 11, 2023
323c99d
Better log messages
jodydonetti Nov 11, 2023
0ed0064
Start using the new native binary serialization methods for Backplane…
jodydonetti Nov 11, 2023
ade6a52
Better logging
jodydonetti Nov 11, 2023
2630d3c
Better tests
jodydonetti Nov 11, 2023
46890cf
Add v0.23.0 payload samples
jodydonetti Nov 11, 2023
11b9eda
Minor
jodydonetti Nov 11, 2023
7a15658
Switch to shorter InstanceId
jodydonetti Nov 11, 2023
9dc7e13
Better logging
jodydonetti Nov 11, 2023
fd28016
Deps update
jodydonetti Nov 11, 2023
07986bd
Start using message serialization to better mimic real backplanes
jodydonetti Nov 11, 2023
e79490e
Minor
jodydonetti Nov 11, 2023
880124b
Minor
jodydonetti Nov 11, 2023
d9b3a70
Better tests
jodydonetti Nov 12, 2023
53aae5b
Docs
jodydonetti Nov 12, 2023
80922a8
Minor
jodydonetti Nov 12, 2023
78c5846
Create the Simulator project
jodydonetti Nov 12, 2023
b66805b
Create the Simulator project
jodydonetti Nov 12, 2023
e886c4d
Add LogicalExpiration to FusionCacheMemoryEntry
jodydonetti Nov 12, 2023
2402405
Better Simulator
jodydonetti Nov 12, 2023
b7c04b9
Add PhysicalExpiration to FusionCacheMemoryEntry
jodydonetti Nov 12, 2023
c2d8cd3
Minor
jodydonetti Nov 12, 2023
61ffd2b
Minor
jodydonetti Nov 12, 2023
3bd66fe
Docs
jodydonetti Nov 12, 2023
9bb21b0
Minor
jodydonetti Nov 12, 2023
e0e9b26
Minor
jodydonetti Nov 12, 2023
728733f
Docs
jodydonetti Nov 12, 2023
4087661
Better tests
jodydonetti Nov 12, 2023
03abd7c
Docs
jodydonetti Nov 12, 2023
77e1444
V0.24.0
jodydonetti Nov 12, 2023
2564bf5
Merge branch 'main' into release/v0_24_0-final
jodydonetti Nov 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Backplane auto-recovery is now Auto-Recovery
jodydonetti committed Oct 8, 2023
commit 045e2339b139b90200616496d5a0284feddc0796
Original file line number Diff line number Diff line change
@@ -17,10 +17,10 @@ internal partial class SerializableFusionCacheDistributedEntry<TValue>
public FusionCacheEntryMetadata? Metadata => Entry?.Metadata;

[MemoryPackInclude]
public long? Timestamp => Entry?.Timestamp;
public long Timestamp => Entry?.Timestamp ?? 0;

[MemoryPackConstructor]
SerializableFusionCacheDistributedEntry(TValue value, FusionCacheEntryMetadata? metadata, long? timestamp)
SerializableFusionCacheDistributedEntry(TValue value, FusionCacheEntryMetadata? metadata, long timestamp)
{
this.Entry = new FusionCacheDistributedEntry<TValue>(value, metadata, timestamp);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

212 changes: 91 additions & 121 deletions src/ZiggyCreatures.FusionCache/FusionCache.cs

Large diffs are not rendered by default.

91 changes: 76 additions & 15 deletions src/ZiggyCreatures.FusionCache/FusionCacheOptions.cs
Original file line number Diff line number Diff line change
@@ -37,11 +37,11 @@ public FusionCacheOptions()

_defaultEntryOptions = new FusionCacheEntryOptions();

// BACKPLANE AUTO-RECOVERY
EnableBackplaneAutoRecovery = true;
BackplaneAutoRecoveryMaxItems = null;
BackplaneAutoRecoveryMaxRetryCount = null;
BackplaneAutoRecoveryDelay = TimeSpan.FromMilliseconds(2_000);
// AUTO-RECOVERY
EnableAutoRecovery = true;
AutoRecoveryMaxItems = null;
AutoRecoveryMaxRetryCount = null;
AutoRecoveryDelay = TimeSpan.FromMilliseconds(2_000);

// LOG LEVELS
IncoherentOptionsNormalizationLogLevel = LogLevel.Warning;
@@ -149,56 +149,117 @@ public FusionCacheEntryOptions DefaultEntryOptions
/// </summary>
public string? BackplaneChannelPrefix { get; set; }

/// <summary>
/// DEPRECATED: please use EnableAutoRecovery.
/// <br/><br/>
/// Enable auto-recovery for the backplane notifications to better handle transient errors without generating synchronization issues: notifications that failed to be sent out will be retried later on, when the backplane becomes responsive again.
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
[Obsolete("Backplane auto-recovery is now simply auto-recovery: please use the EnableAutoRecovery property.")]
public bool EnableBackplaneAutoRecovery
{
get { return EnableAutoRecovery; }
set { EnableAutoRecovery = value; }
}

/// <summary>
/// Enable auto-recovery for the backplane notifications to better handle transient errors without generating synchronization issues: notifications that failed to be sent out will be retried later on, when the backplane becomes responsive again.
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
public bool EnableBackplaneAutoRecovery { get; set; }
public bool EnableAutoRecovery { get; set; }

/// <summary>
/// DEPRECATED: please use AutoRecoveryMaxItems.
/// <br/><br/>
/// The maximum number of items in the auto-recovery queue: this can help reducing memory consumption. If set to <see langword="null"/> there will be no limit.
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
[Obsolete("Backplane auto-recovery is now simply auto-recovery: please use the AutoRecoveryMaxItems property.")]
public int? BackplaneAutoRecoveryMaxItems
{
get { return AutoRecoveryMaxItems; }
set { AutoRecoveryMaxItems = value; }
}

// TODO: CHANGE THE DOCS LINKS TO THE NEW ONE SPECIFIC FOR AUTO-RECOVERY

/// <summary>
/// The maximum number of items in the auto-recovery queue: this can help reducing memory consumption. If set to <see langword="null"/> there will be no limit.
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
public int? BackplaneAutoRecoveryMaxItems { get; set; }
public int? AutoRecoveryMaxItems { get; set; }

/// <summary>
/// The maximum number of retries for a backplane auto-recovery item: after this amount the item is discarded, to avoid keeping it retrying forever. If set to <see langword="null"/> there will be no limit.
/// DEPRECATED: please use AutoRecoveryMaxRetryCount.
/// <br/><br/>
/// The maximum number of retries for a auto-recovery item: after this amount the item is discarded, to avoid keeping it retrying forever. If set to <see langword="null"/> there will be no limit.
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
[Obsolete("Backplane auto-recovery is now simply auto-recovery: please use the AutoRecoveryMaxRetryCount property.")]
public int? BackplaneAutoRecoveryMaxRetryCount
{
get { return AutoRecoveryMaxRetryCount; }
set { AutoRecoveryMaxRetryCount = value; }
}

/// <summary>
/// The maximum number of retries for a auto-recovery item: after this amount the item is discarded, to avoid keeping it retrying forever. If set to <see langword="null"/> there will be no limit.
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
public int? BackplaneAutoRecoveryMaxRetryCount { get; set; }
public int? AutoRecoveryMaxRetryCount { get; set; }

/// <summary>
/// DEPRECATED: please use AutoRecoveryDelay.
/// <br/><br/>
/// The amount of time to wait, after a backplane reconnection, before trying to process the auto-recovery queue: this may be useful to allow all the other nodes to be ready.
/// <br/>
/// Use <see cref="TimeSpan.Zero"/> to avoid any delay (risky).
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
[Obsolete("Please use BackplaneAutoRecoveryDelay instead.")]
[Obsolete("Please use AutoRecoveryDelay instead.")]
public TimeSpan BackplaneAutoRecoveryReconnectDelay
{
get { return BackplaneAutoRecoveryDelay; }
set { BackplaneAutoRecoveryDelay = value; }
get { return AutoRecoveryDelay; }
set { AutoRecoveryDelay = value; }
}

/// <summary>
/// DEPRECATED: please use AutoRecoveryDelay.
/// <br/><br/>
/// The amount of time to wait before actually processing the auto-recovery queue, to better handle backpressure.
/// <br/>
/// Use <see cref="TimeSpan.Zero"/> to avoid any delay (risky).
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
[Obsolete("Backplane auto-recovery is now simply auto-recovery: please use the AutoRecoveryDelay property.")]
public TimeSpan BackplaneAutoRecoveryDelay
{
get; set;
}

/// <summary>
/// The amount of time to wait before actually processing the backplane auto-recovery queue, to better handle backpressure.
/// The amount of time to wait before actually processing the auto-recovery queue, to better handle backpressure.
/// <br/>
/// Use <see cref="TimeSpan.Zero"/> to avoid any delay (risky).
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
public TimeSpan BackplaneAutoRecoveryDelay { get; set; }
public TimeSpan AutoRecoveryDelay { get; set; }

/// <summary>
/// Enable expiring a cache entry, only on the distributed cache (if any), when anauto-recovery message is being published on the backplane, to ensure that the value in the distributed cache will not be stale.
/// <br/><br/>
/// <strong>DOCS:</strong> <see href="https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Backplane.md"/>
/// </summary>
[Obsolete("This is not needed anymore, everything is automatically handled now.")]
[Obsolete("This is not needed anymore, everything is handled automatically now.")]
public bool EnableDistributedExpireOnBackplaneAutoRecovery { get; set; }

/// <summary>
1 change: 1 addition & 0 deletions src/ZiggyCreatures.FusionCache/FusionCache_Async.cs
Original file line number Diff line number Diff line change
@@ -633,6 +633,7 @@ private async ValueTask ExecuteDistributedActionAsync(string operationId, string
var mustAwaitCompletion = MustAwaitDistributedOperations(options);
var isBackground = !mustAwaitCompletion;

// TODO: MAYBE USE A SLIMMER UTIL
await FusionCacheExecutionUtils.RunAsyncActionAdvancedAsync(
async ct =>
{
Original file line number Diff line number Diff line change
@@ -150,8 +150,8 @@ public void Subscribe()

ProcessError(operationId, "", exc, $"subscribing to a backplane of type {_backplane.GetType().FullName}");

if (_logger?.IsEnabled(_options.BackplaneErrorsLogLevel) ?? false)
_logger.Log(_options.BackplaneErrorsLogLevel, exc, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): an error occurred while subscribing to a backplane of type {BackplaneType}", _cache.CacheName, _cache.InstanceId, operationId, "", _backplane.GetType().FullName);
//if (_logger?.IsEnabled(_options.BackplaneErrorsLogLevel) ?? false)
// _logger.Log(_options.BackplaneErrorsLogLevel, exc, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): an error occurred while subscribing to a backplane of type {BackplaneType}", _cache.CacheName, _cache.InstanceId, operationId, "", _backplane.GetType().FullName);
}
}

@@ -167,8 +167,8 @@ public void Unsubscribe()

ProcessError(operationId, "", exc, $"unsubscribing from a backplane of type {_backplane.GetType().FullName}");

if (_logger?.IsEnabled(_options.BackplaneErrorsLogLevel) ?? false)
_logger.Log(_options.BackplaneErrorsLogLevel, exc, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): an error occurred while unsubscribing from a backplane of type {BackplaneType}", _cache.CacheName, _cache.InstanceId, operationId, "", _backplane.GetType().FullName);
//if (_logger?.IsEnabled(_options.BackplaneErrorsLogLevel) ?? false)
// _logger.Log(_options.BackplaneErrorsLogLevel, exc, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): an error occurred while unsubscribing from a backplane of type {BackplaneType}", _cache.CacheName, _cache.InstanceId, operationId, "", _backplane.GetType().FullName);
}
}

@@ -179,7 +179,7 @@ private void HandleConnect(BackplaneConnectionInfo info)
if (_logger?.IsEnabled(LogLevel.Information) ?? false)
_logger.Log(LogLevel.Information, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId}): backplane " + (info.IsReconnection ? "re-connected" : "connected"), _cache.CacheName, _cache.InstanceId, operationId);

if (info.IsReconnection && _options.EnableBackplaneAutoRecovery)
if (info.IsReconnection && _options.EnableAutoRecovery)
{
_cache.TryUpdateAutoRecoveryBarrier(operationId);
}
@@ -208,6 +208,9 @@ private async ValueTask HandleIncomingMessageAsync(BackplaneMessage message)
_events.OnCircuitBreakerChange(operationId, null, true);
}

// EVENT
_events.OnMessageReceived(operationId, message);

// IGNORE NULL
if (message is null)
{
@@ -233,7 +236,7 @@ private async ValueTask HandleIncomingMessageAsync(BackplaneMessage message)
}

// AUTO-RECOVERY
if (_options.EnableBackplaneAutoRecovery)
if (_options.EnableAutoRecovery)
{
if (_cache.CheckIncomingMessageForAutoRecoveryConflicts(operationId, message) == false)
{
@@ -244,9 +247,6 @@ private async ValueTask HandleIncomingMessageAsync(BackplaneMessage message)
}
}

// EVENT
_events.OnMessageReceived(operationId, message);

// PROCESS MESSAGE
switch (message.Action)
{
@@ -290,7 +290,7 @@ private async ValueTask HandleIncomingMessageSetAsync(string operationId, Backpl
if (mca is null)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 0", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): no memory cache, ignoring incoming backplane message", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}

@@ -300,7 +300,7 @@ private async ValueTask HandleIncomingMessageSetAsync(string operationId, Backpl
if (memoryEntry is null)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 1", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): no memory entry, ignoring incoming backplane message", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}

@@ -315,62 +315,44 @@ private async ValueTask HandleIncomingMessageSetAsync(string operationId, Backpl
if (memoryEntry.Timestamp >= message.Timestamp)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 2", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): memory entry more fresh than the incoming backplane message, ignoring incoming backplane message", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}

if (_cache.HasDistributedCache == false)
if (_cache.HasDistributedCache)
{
_cache.MaybeExpireMemoryEntryInternal(operationId, cacheKey, true, message.Timestamp);
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 3", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}

var dca = _cache.GetCurrentDistributedAccessor(null);
if (dca.CanBeUsed(operationId, cacheKey) == false)
{
_cache.MaybeExpireMemoryEntryInternal(operationId, cacheKey, true, message.Timestamp);
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 4", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}

//if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
// _logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): during backplane auto-recovery of an item, the distributed cache was necessary (because of the EnableDistributedExpireOnBackplaneAutoRecovery option) but was not available", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);

if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 5", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
var dca = _cache.GetCurrentDistributedAccessor(null);
if (dca.CanBeUsed(operationId, cacheKey) == false)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): distributed cache not currently usable, expiring local memory entry", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);

(var isSame, var hasUpdated) = await _cache.TryUpdateMemoryEntryFromDistributedEntryAsync(operationId, cacheKey, memoryEntry).ConfigureAwait(false);
_cache.MaybeExpireMemoryEntryInternal(operationId, cacheKey, true, message.Timestamp);

if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 6", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}

if (isSame)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 7", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}
(var error, var isSame, var hasUpdated) = await _cache.TryUpdateMemoryEntryFromDistributedEntryUntypedAsync(operationId, cacheKey, memoryEntry).ConfigureAwait(false);

if (hasUpdated)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 8", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
if (error == false)
{
if (isSame)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): memory entry is the same as the distributed entry, ignoring incoming backplane message", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}

if (hasUpdated)
{
if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): memory entry updated from the distributed entry, ignoring incoming backplane message", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);
return;
}
}
}

_cache.MaybeExpireMemoryEntryInternal(operationId, cacheKey, true, null);

if (_logger?.IsEnabled(LogLevel.Trace) ?? false)
_logger.Log(LogLevel.Trace, "FUSION [N={CacheName} I={CacheInstanceId}] (O={CacheOperationId} K={CacheKey}): AAA 9", _cache.CacheName, _cache.InstanceId, operationId, cacheKey);

//// TODO: CACHE THE METHOD INFO
//var methodInfo = typeof(BackplaneAccessor).GetMethod(nameof(Foo), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).MakeGenericMethod(memoryEntry.ValueType);
//var task = (Task)methodInfo.Invoke(this, new object[] { operationId, cacheKey, dca!, options, memoryEntry });

//await task.ConfigureAwait(false);
}

public async ValueTask<bool> PublishSentinelAsync(string operationId, string key, FusionCacheEntryOptions options, CancellationToken token)
Loading