diff options
Diffstat (limited to 'Timeline/Controllers')
-rw-r--r-- | Timeline/Controllers/TimelineController.cs | 9 | ||||
-rw-r--r-- | Timeline/Controllers/UserAvatarController.cs | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Timeline/Controllers/TimelineController.cs b/Timeline/Controllers/TimelineController.cs index 58390c29..8bc0345f 100644 --- a/Timeline/Controllers/TimelineController.cs +++ b/Timeline/Controllers/TimelineController.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Timeline.Filters;
+using Timeline.Helpers;
using Timeline.Models;
using Timeline.Models.Http;
using Timeline.Models.Validation;
@@ -114,7 +115,6 @@ namespace Timeline.Controllers return result;
}
- // TODO: Make cache available.
[HttpGet("timelines/{name}/posts/{id}/data")]
public async Task<ActionResult<List<TimelinePostInfo>>> PostDataGet([FromRoute][GeneralTimelineName] string name, [FromRoute] long id)
{
@@ -125,8 +125,11 @@ namespace Timeline.Controllers try
{
- var data = await _service.GetPostData(name, id);
- return File(data.Data, data.Type, data.LastModified, new EntityTagHeaderValue($"\"{data.ETag}\""));
+ return await DataCacheHelper.GenerateActionResult(this, () => _service.GetPostDataETag(name, id), async () =>
+ {
+ var data = await _service.GetPostData(name, id);
+ return data;
+ });
}
catch (TimelinePostNotExistException)
{
diff --git a/Timeline/Controllers/UserAvatarController.cs b/Timeline/Controllers/UserAvatarController.cs index f78dcb08..b5f4be1e 100644 --- a/Timeline/Controllers/UserAvatarController.cs +++ b/Timeline/Controllers/UserAvatarController.cs @@ -32,7 +32,6 @@ namespace Timeline.Controllers }
[HttpGet("users/{username}/avatar")]
- [ResponseCache(NoStore = false, Location = ResponseCacheLocation.None, Duration = 0)]
public async Task<IActionResult> Get([FromRoute][Username] string username)
{
long id;
|