public IReadOnlyList <LapTimeEntry> GetCachedLapTimesList(ILapTimesReader reader) { var lastUpdated = this.GetDateTime(KeyLastUpdated); return(lastUpdated.HasValue && reader.GetLastModified() < lastUpdated.Value ? GetLapTimes().ToList() : null); }
public IReadOnlyList<LapTimeEntry> UpdateCachedLapTimesList(ILapTimesReader reader) { CleanUp(x => x.StartsWith(KeyPrefix)); var list = reader.GetEntries().ToList(); foreach (var entry in list) { Set(entry); } Set(KeyLastUpdated, reader.GetLastModified()); return list; }
public IReadOnlyList <LapTimeEntry> UpdateCached([NotNull] ILapTimesReader reader) { CleanUp(x => x.StartsWith(KeyPrefix)); var list = reader.Import(_displayName).ToList(); foreach (var entry in list) { Set(entry); } SyncLastModified(reader); return(list); }
public IReadOnlyList <LapTimeEntry> UpdateCachedLapTimesList(ILapTimesReader reader) { CleanUp(x => x.StartsWith(KeyPrefix)); var list = reader.Import().ToList(); foreach (var entry in list) { Set(entry); } this.Set(KeyLastUpdated, reader.GetLastModified()); return(list); }
public IReadOnlyList<LapTimeEntry> GetLapTimesList(ILapTimesReader reader) { return GetCachedLapTimesList(reader) ?? UpdateCachedLapTimesList(reader); }
public IReadOnlyList<LapTimeEntry> GetCachedLapTimesList(ILapTimesReader reader) { var lastUpdated = GetDateTime(KeyLastUpdated); return lastUpdated.HasValue && reader.GetLastModified() < lastUpdated.Value ? GetLapTimes().ToList() : null; }
public void SyncLastModified(ILapTimesReader reader) { LastModified = reader.GetLastModified(); Set(KeyLastUpdated, LastModified.Value); }
public Task <IReadOnlyList <LapTimeEntry> > UpdateCachedAsync([NotNull] ILapTimesReader reader) { return(Task.Run(() => UpdateCached(reader))); }
public bool IsActual([NotNull] ILapTimesReader reader) { return(LastModified.HasValue && reader.GetLastModified() <= LastModified.Value + TimeSpan.FromSeconds(1d)); }
public IReadOnlyList <LapTimeEntry> GetLapTimesList(ILapTimesReader reader) { return(GetCachedLapTimesList(reader) ?? UpdateCachedLapTimesList(reader)); }
public bool IsActual(ILapTimesReader reader) { return(LastModified.HasValue && reader.GetLastModified() < LastModified.Value); }