aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-03 23:04:19 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-03 23:04:19 -0500
commit351cfef7a70ef311801be0bc9eb9e3891265d22b (patch)
treeedb841c6b311a1c13c4c70cbd4ed08e9129fac78 /MediaBrowser.Controller
parent48b9f657a4d163e4be32c1641907fc429481aa85 (diff)
use conditional caching on some json responses
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs9
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs4
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs2
-rw-r--r--MediaBrowser.Controller/Net/IHttpResultFactory.cs14
4 files changed, 24 insertions, 5 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 5a041860b..650a9bad0 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -253,6 +253,15 @@ namespace MediaBrowser.Controller.Entities
}
}
+ [IgnoreDataMember]
+ public IEnumerable<string> PhysicalLocations
+ {
+ get
+ {
+ return ResolveArgs.PhysicalLocations;
+ }
+ }
+
/// <summary>
/// Resets the resolve args.
/// </summary>
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 0d6bed90b..6220bc4d5 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -84,7 +84,7 @@ namespace MediaBrowser.Controller.Entities
try
{
- locationsDicionary = ResolveArgs.PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+ locationsDicionary = PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
}
catch (IOException ex)
{
@@ -116,7 +116,7 @@ namespace MediaBrowser.Controller.Entities
try
{
- locationsDicionary = ResolveArgs.PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+ locationsDicionary = PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
}
catch (IOException ex)
{
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 94db04864..02da2fe61 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -1079,7 +1079,7 @@ namespace MediaBrowser.Controller.Entities
if (i.LocationType != LocationType.Remote)
{
- if (i.ResolveArgs.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase))
+ if (i.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase))
{
return true;
}
diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
index 0614db12e..b7dff96cd 100644
--- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs
+++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
@@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Net
/// <param name="factoryFn">The factory function that creates the response object.</param>
/// <param name="responseHeaders">The response headers.</param>
/// <returns>System.Object.</returns>
- object GetOptimizedResultUsingCache<T>(IRequest requestContext, Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func<T> factoryFn, IDictionary<string, string> responseHeaders = null)
+ object GetOptimizedResultUsingCache<T>(IRequest requestContext, Guid cacheKey, DateTime? lastDateModified, TimeSpan? cacheDuration, Func<T> factoryFn, IDictionary<string, string> responseHeaders = null)
where T : class;
/// <summary>
@@ -65,7 +65,7 @@ namespace MediaBrowser.Controller.Net
/// <param name="contentType">Type of the content.</param>
/// <param name="responseHeaders">The response headers.</param>
/// <returns>System.Object.</returns>
- object GetCachedResult<T>(IRequest requestContext, Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func<T> factoryFn, string contentType, IDictionary<string, string> responseHeaders = null)
+ object GetCachedResult<T>(IRequest requestContext, Guid cacheKey, DateTime? lastDateModified, TimeSpan? cacheDuration, Func<T> factoryFn, string contentType, IDictionary<string, string> responseHeaders = null)
where T : class;
/// <summary>
@@ -94,5 +94,15 @@ namespace MediaBrowser.Controller.Net
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
/// <returns>System.Object.</returns>
object GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false);
+
+ /// <summary>
+ /// Gets the optimized serialized result using cache.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="request">The request.</param>
+ /// <param name="result">The result.</param>
+ /// <returns>System.Object.</returns>
+ object GetOptimizedSerializedResultUsingCache<T>(IRequest request, T result)
+ where T : class;
}
}