77e30685bb
- Implements Phases 3–6: session isolation, cache coordination, primary election, and file system monitor coordination for Jellyfin with PostgreSQL. - Adds new database entities (Instance, DistributedLock, FileSystemChange) and EF model configurations. - Includes SQL migration scripts and EF migration for all required tables, columns, and helper functions. - Updates Device entity and JellyfinDbContext for multi-instance tracking. - Integrates new DI services for instance registry, distributed locks, cache coordinator, and primary election. - Adds publishing profiles (Win/Linux/FrameworkDependent) and automation script for deployment. - Extensive documentation for architecture, setup, and publishing. - All changes are backward compatible and build successfully.
108 lines
2.7 KiB
C#
108 lines
2.7 KiB
C#
// <copyright file="CacheInvalidationMessage.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Server.Implementations.Clustering
|
|
{
|
|
using System;
|
|
using System.Text.Json.Serialization;
|
|
|
|
/// <summary>
|
|
/// Types of cache invalidation.
|
|
/// </summary>
|
|
public enum CacheInvalidationType
|
|
{
|
|
/// <summary>
|
|
/// Invalidate a specific item cache.
|
|
/// </summary>
|
|
Item,
|
|
|
|
/// <summary>
|
|
/// Invalidate user data cache.
|
|
/// </summary>
|
|
UserData,
|
|
|
|
/// <summary>
|
|
/// Invalidate image cache.
|
|
/// </summary>
|
|
Image,
|
|
|
|
/// <summary>
|
|
/// Invalidate chapter image cache.
|
|
/// </summary>
|
|
ChapterImage,
|
|
|
|
/// <summary>
|
|
/// Invalidate metadata cache.
|
|
/// </summary>
|
|
Metadata,
|
|
|
|
/// <summary>
|
|
/// Invalidate all caches of a specific type.
|
|
/// </summary>
|
|
All,
|
|
|
|
/// <summary>
|
|
/// Invalidate library cache.
|
|
/// </summary>
|
|
Library,
|
|
|
|
/// <summary>
|
|
/// Invalidate person cache.
|
|
/// </summary>
|
|
Person,
|
|
|
|
/// <summary>
|
|
/// Invalidate user cache.
|
|
/// </summary>
|
|
User,
|
|
|
|
/// <summary>
|
|
/// Invalidate device cache.
|
|
/// </summary>
|
|
Device
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a cache invalidation message sent between instances.
|
|
/// </summary>
|
|
public class CacheInvalidationMessage
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the type of cache being invalidated.
|
|
/// </summary>
|
|
[JsonPropertyName("type")]
|
|
public CacheInvalidationType Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the ID of the entity being invalidated (if applicable).
|
|
/// </summary>
|
|
[JsonPropertyName("entityId")]
|
|
public Guid? EntityId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the cache key pattern to invalidate.
|
|
/// </summary>
|
|
[JsonPropertyName("cacheKey")]
|
|
public string? CacheKey { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the timestamp when this message was created.
|
|
/// </summary>
|
|
[JsonPropertyName("timestamp")]
|
|
public DateTime Timestamp { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the instance ID that originated this message.
|
|
/// </summary>
|
|
[JsonPropertyName("sourceInstanceId")]
|
|
public Guid SourceInstanceId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets additional metadata about the invalidation.
|
|
/// </summary>
|
|
[JsonPropertyName("metadata")]
|
|
public string? Metadata { get; set; }
|
|
}
|
|
}
|