Пример #1
0
        public IReadOnlyList <LapTimeEntry> GetCachedLapTimesList(ILapTimesReader reader)
        {
            var lastUpdated = this.GetDateTime(KeyLastUpdated);

            return(lastUpdated.HasValue && reader.GetLastModified() < lastUpdated.Value ?
                   GetLapTimes().ToList() : null);
        }
Пример #2
0
        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;
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
 public IReadOnlyList<LapTimeEntry> GetLapTimesList(ILapTimesReader reader) {
     return GetCachedLapTimesList(reader) ?? UpdateCachedLapTimesList(reader);
 }
Пример #6
0
 public IReadOnlyList<LapTimeEntry> GetCachedLapTimesList(ILapTimesReader reader) {
     var lastUpdated = GetDateTime(KeyLastUpdated);
     return lastUpdated.HasValue && reader.GetLastModified() < lastUpdated.Value ?
             GetLapTimes().ToList() : null;
 }
Пример #7
0
 public void SyncLastModified(ILapTimesReader reader)
 {
     LastModified = reader.GetLastModified();
     Set(KeyLastUpdated, LastModified.Value);
 }
Пример #8
0
 public Task <IReadOnlyList <LapTimeEntry> > UpdateCachedAsync([NotNull] ILapTimesReader reader)
 {
     return(Task.Run(() => UpdateCached(reader)));
 }
Пример #9
0
 public bool IsActual([NotNull] ILapTimesReader reader)
 {
     return(LastModified.HasValue && reader.GetLastModified() <= LastModified.Value + TimeSpan.FromSeconds(1d));
 }
Пример #10
0
 public IReadOnlyList <LapTimeEntry> GetLapTimesList(ILapTimesReader reader)
 {
     return(GetCachedLapTimesList(reader) ?? UpdateCachedLapTimesList(reader));
 }
Пример #11
0
 public bool IsActual(ILapTimesReader reader)
 {
     return(LastModified.HasValue && reader.GetLastModified() < LastModified.Value);
 }