Exemple #1
0
 public CacheValue(List <ReleaseDownload> releases)
 {
     Releases = releases;
     // "Latest" is in terms of version, not release date. (So if
     // 1.4 comes out after 2.0, 2.0 is still latest.)
     LatestRelease = releases
                     .Where(r => !r.File.Contains("-src"))
                     .OrderByDescending(r => r.Release)
                     .First();
 }
        private void MaybeUpdateReleases()
        {
            if (releases != null && Clock.GetCurrentInstant() < nextCacheRefresh)
            {
                return;
            }

            nextCacheRefresh = Clock.GetCurrentInstant() + CacheRefreshTime;
            releases         = client
                               .ListObjects(Bucket, ObjectPrefix)
                               .Where(obj => !obj.Name.EndsWith("/"))
                               .Select(ConvertObject)
                               .OrderByDescending(r => r.Release)
                               .ToList();
            // "Latest" is in terms of version, not release date. (So if
            // 1.4 comes out after 2.0, 2.0 is still latest.)
            latestRelease = releases
                            .OrderByDescending(r => r.Release)
                            .First();
        }