b662ffa48f
Add a Redis pub/sub invalidation bus, publish from the configuration and library-option write paths, and drop the matching local cache entry on the instances that did not write. No-op without a Redis connection string, and fails open when it is unreachable.
29 lines
1.2 KiB
C#
29 lines
1.2 KiB
C#
using System;
|
|
|
|
namespace MediaBrowser.Common.Configuration
|
|
{
|
|
/// <summary>
|
|
/// Carries cache-invalidation notices between the instances that share one configuration directory.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The shared directory carries the content; this bus only carries the fact that it changed. Every
|
|
/// implementation is expected to fail open: a bus that cannot deliver must not throw into the write
|
|
/// path, leaving each instance on its own locally cached copy until it restarts.
|
|
/// </remarks>
|
|
public interface IConfigurationInvalidationBus
|
|
{
|
|
/// <summary>
|
|
/// Announces that this instance has written shared configuration.
|
|
/// </summary>
|
|
/// <param name="scope">The cache that was written.</param>
|
|
/// <param name="target">The configuration key or library path that was written, if any.</param>
|
|
void Publish(ConfigurationInvalidationScope scope, string? target);
|
|
|
|
/// <summary>
|
|
/// Registers the handler invoked for notices published by other instances.
|
|
/// </summary>
|
|
/// <param name="handler">The handler applying the invalidation locally.</param>
|
|
void Subscribe(Action<ConfigurationInvalidation> handler);
|
|
}
|
|
}
|