コード例 #1
0
 public string this[string url]
 {
     get
     {
         if (OnlineVideoSettings.Instance.CacheTimeout > 0) // only use cache if a timeout > 0 was set
         {
             lock (this)
             {
                 WebCacheEntry result = null;
                 if (cache.TryGetValue(url, out result))
                 {
                     return(result.Data);
                 }
             }
         }
         return(null);
     }
     set
     {
         if (OnlineVideoSettings.Instance.CacheTimeout > 0) // only use cache if a timeout > 0 was set
         {
             lock (this)
             {
                 cache[url] = new WebCacheEntry()
                 {
                     Data = value, LastUpdated = DateTime.Now
                 };
             }
         }
     }
 }
コード例 #2
0
 public string this[string url]
 {
     get
     {
         if (cacheTimeout > 0) // only use cache if a timeout > 0 was set
         {
             lock (this)
             {
                 WebCacheEntry result = null;
                 if (cache.TryGetValue(url, out result))
                 {
                     return result.Data;
                 }
             }
         }
         return null;
     }
     set
     {
         if (cacheTimeout > 0) // only use cache if a timeout > 0 was set
         {
             lock (this)
             {
                 cache[url] = new WebCacheEntry() { Data = value, LastUpdated = DateTime.Now };
             }
         }
     }
 }