/// <summary> /// Initializes a new instance of the <see cref="T:FFImageLoading.Cache.ReuseBitmapDrawableCache`1"/> class. /// </summary> /// <param name="logger">Logger.</param> /// <param name="memoryCacheSize">Memory cache size.</param> /// <param name="bitmapPoolSize">Bitmap pool size.</param> /// <param name="verboseLogging">If set to <c>true</c> verbose logging.</param> public ReuseBitmapDrawableCache(IMiniLogger logger, int memoryCacheSize, int bitmapPoolSize, bool verboseLogging = false) { _verboseLogging = verboseLogging; log = logger; low_watermark = bitmapPoolSize / 2; high_watermark = bitmapPoolSize; displayed_cache = new ByteBoundStrongLruCache <TValue>(memoryCacheSize); reuse_pool = new ByteBoundStrongLruCache <TValue>(bitmapPoolSize); reuse_pool.EntryRemoved += OnEntryRemovedFromReusePool; }
/// <summary> /// Initializes a new instance of the <see cref="T:FFImageLoading.Cache.ReuseBitmapDrawableCache`1"/> class. /// </summary> /// <param name="logger">Logger.</param> /// <param name="memoryCacheSize">Memory cache size.</param> /// <param name="bitmapPoolSize">Bitmap pool size.</param> /// <param name="verboseLogging">If set to <c>true</c> verbose logging.</param> public ReuseBitmapDrawableCache(IMiniLogger logger, int memoryCacheSize, int bitmapPoolSize, bool verboseLogging = false) { _gcThreshold = bitmapPoolSize; _verboseLogging = verboseLogging; _log = logger; _bitmapPoolSize = bitmapPoolSize; _displayed_cache = new ByteBoundStrongLruCache <TValue>(memoryCacheSize); _reuse_pool = new ByteBoundStrongLruCache <TValue>(bitmapPoolSize); _reuse_pool.EntryRemoved += OnEntryRemovedFromReusePool; }
/// <summary> /// Initializes a new instance of the <see cref="ReuseBitmapDrawableCache"/> class. /// </summary> /// <param name="logger">Logger for debug messages</param> /// <param name="highWatermark">Maximum number of bytes the reuse pool will hold before starting evictions. /// <param name="lowWatermark">Number of bytes the reuse pool will be drained down to after the high watermark is exceeded.</param> public ReuseBitmapDrawableCache(IMiniLogger logger, int highWatermark, int lowWatermark, bool verboseLogging = false) { _verboseLogging = verboseLogging; log = logger; low_watermark = lowWatermark; high_watermark = highWatermark; displayed_cache = new StrongCache <TValue>(); reuse_pool = new ByteBoundStrongLruCache <TValue>(high_watermark, low_watermark); reuse_pool.EntryRemoved += OnEntryRemovedFromReusePool; }
/// <summary> /// Initializes a new instance of the <see cref="AndroidBitmapDrawableCache"/> class. /// </summary> /// <param name="highWatermark">Maximum number of bytes the reuse pool will hold before starting evictions. /// <param name="lowWatermark">Number of bytes the reuse pool will be drained down to after the high watermark is exceeded.</param> /// On Honeycomb and higher this value is used for the reuse pool size.</param> /// <param name="gcThreshold">Threshold in bytes that triggers a System.GC.Collect (Honeycomb+ only).</param> /// <param name="debugDump">If set to <c>true</c> dump stats to log every 10 seconds.</param> public ReuseBitmapDrawableCache(long highWatermark, long lowWatermark, long gcThreshold = 2 * 1024 * 1024, bool debugDump = false) { low_watermark = lowWatermark; high_watermark = highWatermark; gc_threshold = gcThreshold; displayed_cache = new Dictionary <string, SelfDisposingBitmapDrawable>(); reuse_pool = new ByteBoundStrongLruCache <string, SelfDisposingBitmapDrawable>(highWatermark, lowWatermark); reuse_pool.EntryRemoved += OnEntryRemovedFromReusePool; if (debugDump) { main_thread_handler = new Handler(); DebugDumpStats(); } }
/// <summary> /// Initializes a new instance of the <see cref="AndroidBitmapDrawableCache"/> class. /// </summary> /// <param name="logger">Logger for debug messages</param> /// <param name="highWatermark">Maximum number of bytes the reuse pool will hold before starting evictions. /// <param name="lowWatermark">Number of bytes the reuse pool will be drained down to after the high watermark is exceeded.</param> /// On Honeycomb and higher this value is used for the reuse pool size.</param> /// <param name="gcThreshold">Threshold in bytes that triggers a System.GC.Collect (Honeycomb+ only).</param> /// <param name="debugDump">If set to <c>true</c> dump stats to log every 10 seconds.</param> public ReuseBitmapDrawableCache(IMiniLogger logger, long highWatermark, long lowWatermark, long gcThreshold = 2 * 1024 * 1024, bool verboseLogging = false) { _verboseLogging = verboseLogging; log = logger; low_watermark = lowWatermark; high_watermark = highWatermark; gc_threshold = gcThreshold; displayed_cache = new Dictionary <string, ISelfDisposingBitmapDrawable>(); reuse_pool = new ByteBoundStrongLruCache <string, ISelfDisposingBitmapDrawable>(highWatermark, lowWatermark); reuse_pool.EntryRemoved += OnEntryRemovedFromReusePool; // if (_verboseLogging) { // main_thread_handler = new Handler(); // DebugDumpStats(); //} }