public bool IsExpired(PicturesCacheValue cacheValue)
        {
            Console.WriteLine("Checking expiration");

            var totalMilliseconds = DateTime.UtcNow.Subtract(cacheValue.Time).TotalMilliseconds;

            Console.WriteLine("totalMilliseconds {0}", totalMilliseconds);

            return(totalMilliseconds >= duration);
        }
        public void AddPicture(string devicePath, PictureSize pictureSize, Percent jpegCompressionRate, byte[] data)
        {
            var cacheKey = new PicturesCacheKey
            {
                DevicePath  = devicePath,
                PictureSize = pictureSize
            };
            var cacheValue = new PicturesCacheValue
            {
                Time = DateTime.UtcNow,
                Data = data
            };

            if (!cacheValues.ContainsKey(cacheKey))
            {
                cacheValues.Add(cacheKey, cacheValue);
                return;
            }

            cacheValues[cacheKey] = cacheValue;
        }
 public bool Equals(PicturesCacheValue other)
 {
     return(Equals(Data, other.Data) && Time.Equals(other.Time));
 }