//
// Copyright (c) PlaceholderCompany. All rights reserved.
//
namespace Jellyfin.Server.Implementations.Clustering
{
using System;
using System.Threading;
using System.Threading.Tasks;
///
/// Interface for coordinating cache invalidation across multiple instances.
///
public interface ICacheCoordinator
{
///
/// Starts the cache coordinator.
///
/// Cancellation token.
/// A task representing the asynchronous operation.
Task StartAsync(CancellationToken cancellationToken = default);
///
/// Stops the cache coordinator.
///
/// Cancellation token.
/// A task representing the asynchronous operation.
Task StopAsync(CancellationToken cancellationToken = default);
///
/// Invalidates an item cache across all instances.
///
/// The item ID.
/// Cancellation token.
/// A task representing the asynchronous operation.
Task InvalidateItemAsync(Guid itemId, CancellationToken cancellationToken = default);
///
/// Invalidates user data cache across all instances.
///
/// The user ID.
/// Cancellation token.
/// A task representing the asynchronous operation.
Task InvalidateUserDataAsync(Guid userId, CancellationToken cancellationToken = default);
///
/// Invalidates an image cache across all instances.
///
/// The item ID.
/// Cancellation token.
/// A task representing the asynchronous operation.
Task InvalidateImageAsync(Guid itemId, CancellationToken cancellationToken = default);
///
/// Invalidates all caches of a specific type across all instances.
///
/// The cache type.
/// Cancellation token.
/// A task representing the asynchronous operation.
Task InvalidateAllAsync(CacheInvalidationType cacheType, CancellationToken cancellationToken = default);
///
/// Invalidates a library cache across all instances.
///
/// The library ID.
/// Cancellation token.
/// A task representing the asynchronous operation.
Task InvalidateLibraryAsync(Guid libraryId, CancellationToken cancellationToken = default);
///
/// Invalidates a person cache across all instances.
///
/// The person ID.
/// Cancellation token.
/// A task representing the asynchronous operation.
Task InvalidatePersonAsync(Guid personId, CancellationToken cancellationToken = default);
///
/// Invalidates metadata for an item across all instances.
///
/// The item ID.
/// Cancellation token.
/// A task representing the asynchronous operation.
Task InvalidateMetadataAsync(Guid itemId, CancellationToken cancellationToken = default);
}
}