mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
resolve config caching issue
This commit is contained in:
parent
35e48e4990
commit
2f1996b773
@ -58,21 +58,6 @@ namespace MediaBrowser.Api
|
||||
return ResultFactory.GetOptimizedResult(Request, result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To the optimized result using cache.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="cacheKey">The cache key.</param>
|
||||
/// <param name="lastDateModified">The last date modified.</param>
|
||||
/// <param name="cacheDuration">Duration of the cache.</param>
|
||||
/// <param name="factoryFn">The factory function.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
protected object ToOptimizedResultUsingCache<T>(Guid cacheKey, DateTime? lastDateModified, TimeSpan? cacheDuration, Func<T> factoryFn)
|
||||
where T : class
|
||||
{
|
||||
return ResultFactory.GetOptimizedResultUsingCache(Request, cacheKey, lastDateModified, cacheDuration, factoryFn);
|
||||
}
|
||||
|
||||
protected void AssertCanUpdateUser(IUserManager userManager, string userId)
|
||||
{
|
||||
var auth = AuthorizationContext.GetAuthorizationInfo(Request);
|
||||
|
@ -105,13 +105,7 @@ namespace MediaBrowser.Api
|
||||
/// <returns>System.Object.</returns>
|
||||
public object Get(GetConfiguration request)
|
||||
{
|
||||
var configPath = _configurationManager.ApplicationPaths.SystemConfigurationFilePath;
|
||||
|
||||
var dateModified = _fileSystem.GetLastWriteTimeUtc(configPath);
|
||||
|
||||
var cacheKey = (configPath + dateModified.Ticks).GetMD5();
|
||||
|
||||
return ToOptimizedResultUsingCache(cacheKey, dateModified, null, () => _configurationManager.Configuration);
|
||||
return ToOptimizedResult(_configurationManager.Configuration);
|
||||
}
|
||||
|
||||
public object Get(GetNamedConfiguration request)
|
||||
|
@ -250,11 +250,7 @@ namespace MediaBrowser.Api
|
||||
var guid = new Guid(request.Id);
|
||||
var plugin = _appHost.Plugins.First(p => p.Id == guid);
|
||||
|
||||
var dateModified = plugin.ConfigurationDateLastModified;
|
||||
|
||||
var cacheKey = (plugin.Version.ToString() + dateModified.Ticks).GetMD5();
|
||||
|
||||
return ToOptimizedResultUsingCache(cacheKey, dateModified, null, () => plugin.Configuration);
|
||||
return ToOptimizedResult(plugin.Configuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user