Esempio n. 1
0
        /// <summary>
        /// Gets the directory to use to store the given key.
        /// </summary>
        /// <param name="resourceId">
        /// The id of the file we're going to store.
        /// </param>
        /// <returns>The directory to store the file in.</returns>
        private string GetSubdirectoryPath(string resourceId)
        {
            int    hashCode     = HashCodeUtil.HashCode(resourceId);
            string subdirectory = Math.Abs(hashCode % SHARDING_BUCKET_COUNT).ToString();

            return(Path.Combine(_versionDirectory.FullName, subdirectory));
        }
Esempio n. 2
0
 /// <summary>
 ///  Instantites the <see cref="BitmapMemoryCacheKey"/>.
 /// </summary>
 public BitmapMemoryCacheKey(
     string sourceString,
     ResizeOptions resizeOptions,
     bool autoRotated,
     ImageDecodeOptions imageDecodeOptions,
     ICacheKey postprocessorCacheKey,
     string postprocessorName,
     object callerContext)
 {
     _sourceString          = Preconditions.CheckNotNull(sourceString);
     _resizeOptions         = resizeOptions;
     _autoRotated           = autoRotated;
     _imageDecodeOptions    = imageDecodeOptions;
     _postprocessorCacheKey = postprocessorCacheKey;
     _postprocessorName     = postprocessorName;
     _hash = HashCodeUtil.HashCode(
         sourceString.GetHashCode(),
         (resizeOptions != null) ? resizeOptions.GetHashCode() : 0,
         autoRotated ? true.GetHashCode() : false.GetHashCode(),
         _imageDecodeOptions,
         _postprocessorCacheKey,
         postprocessorName);
     _callerContext = callerContext;
     _cacheTime     = SystemClock.UptimeMillis;
 }
 /// <summary>
 /// Custom GetHashCode method.
 /// </summary>
 public override int GetHashCode()
 {
     return(HashCodeUtil.HashCode(CacheChoice, SourceUri, SourceFile));
 }
 /// <summary>
 /// Calculates the hash code basing on width and height.
 /// </summary>
 public override int GetHashCode()
 {
     return(HashCodeUtil.HashCode(Width, Height));
 }