Right, so optimistic concurrency control is what I was referring to when I said stale data update. Regardless, correct, it’s not caching and probably shouldn’t have been labeled as such. I just added some simple extensions to check it exactly that way, and one for creating an exception with 412 response.
public static class HttpAdditionalExtensions
{
public static bool UnModifiedSince(this IRequest req, DateTime? lastModified)
{
if (lastModified.HasValue)
{
string header = req.Headers[HttpHeaders.IfUnmodifiedSince];
DateTime result;
if (header == null)
return false;
if (header != null && DateTime.TryParse(header, new DateTimeFormatInfo(), DateTimeStyles.RoundtripKind, out result))
{
DateTime universalTime = lastModified.Value.Truncate(TimeSpan.FromSeconds(1.0)).ToUniversalTime();
return result >= universalTime;
}
}
return false;
}
public static Exception NotModified(string description = null)
{
return (Exception)new HttpError(HttpStatusCode.PreconditionFailed, description);
}
}
Sometimes just writing a post and asking a question makes it more clear. Added my code above if anyone is doing the same.