1package com.bumptech.glide.load.engine; 2 3/** 4 * Set of available caching strategies for media. 5 */ 6public enum DiskCacheStrategy { 7 /** Caches with both {@link #SOURCE} and {@link #RESULT}. */ 8 ALL(true, true), 9 /** Saves no data to cache. */ 10 NONE(false, false), 11 /** Saves just the original data to cache. */ 12 SOURCE(true, false), 13 /** Saves the media item after all transformations to cache. */ 14 RESULT(false, true); 15 16 private final boolean cacheSource; 17 private final boolean cacheResult; 18 19 DiskCacheStrategy(boolean cacheSource, boolean cacheResult) { 20 this.cacheSource = cacheSource; 21 this.cacheResult = cacheResult; 22 } 23 24 /** 25 * Returns true if this request should cache the original unmodified data. 26 */ 27 public boolean cacheSource() { 28 return cacheSource; 29 } 30 31 /** 32 * Returns true if this request should cache the final transformed result. 33 */ 34 public boolean cacheResult() { 35 return cacheResult; 36 } 37} 38