//
// Copyright (c) PlaceholderCompany. All rights reserved.
//
namespace Jellyfin.Server.Implementations.Clustering
{
using System;
using System.Text.Json.Serialization;
///
/// Types of cache invalidation.
///
public enum CacheInvalidationType
{
///
/// Invalidate a specific item cache.
///
Item,
///
/// Invalidate user data cache.
///
UserData,
///
/// Invalidate image cache.
///
Image,
///
/// Invalidate chapter image cache.
///
ChapterImage,
///
/// Invalidate metadata cache.
///
Metadata,
///
/// Invalidate all caches of a specific type.
///
All,
///
/// Invalidate library cache.
///
Library,
///
/// Invalidate person cache.
///
Person,
///
/// Invalidate user cache.
///
User,
///
/// Invalidate device cache.
///
Device
}
///
/// Represents a cache invalidation message sent between instances.
///
public class CacheInvalidationMessage
{
///
/// Gets or sets the type of cache being invalidated.
///
[JsonPropertyName("type")]
public CacheInvalidationType Type { get; set; }
///
/// Gets or sets the ID of the entity being invalidated (if applicable).
///
[JsonPropertyName("entityId")]
public Guid? EntityId { get; set; }
///
/// Gets or sets the cache key pattern to invalidate.
///
[JsonPropertyName("cacheKey")]
public string? CacheKey { get; set; }
///
/// Gets or sets the timestamp when this message was created.
///
[JsonPropertyName("timestamp")]
public DateTime Timestamp { get; set; }
///
/// Gets or sets the instance ID that originated this message.
///
[JsonPropertyName("sourceInstanceId")]
public Guid SourceInstanceId { get; set; }
///
/// Gets or sets additional metadata about the invalidation.
///
[JsonPropertyName("metadata")]
public string? Metadata { get; set; }
}
}