-
- All Implemented Interfaces:
-
com.clevertap.android.sdk.inapp.images.memory.Memory
public final class InAppImageMemoryV1 implements Memory<Bitmap>
A memory management implementation for in-app images, providing both in-memory and disk-based storage.
This class utilizes InMemoryLruCache for efficient in-memory caching of bitmaps and DiskMemory for persistent storage of images on disk. It manages the creation and configuration of these storages based on the provided MemoryConfig.
-
-
Constructor Summary
Constructors Constructor Description InAppImageMemoryV1(MemoryConfig config, ILogger logger)
-
Method Summary
Modifier and Type Method Description InMemoryLruCache<Pair<Bitmap, File>>createInMemory()Creates and returns an in-memory LRU cache for storing bitmaps. DiskMemorycreateDiskMemory()Creates and returns a disk-based storage mechanism for persisting bitmaps. IntegerinMemorySize()Calculates and returns the size of the in-memory cache in kilobytes. UnitfreeInMemory()Clears the in-memory cache, releasing all held bitmaps. -
-
Constructor Detail
-
InAppImageMemoryV1
InAppImageMemoryV1(MemoryConfig config, ILogger logger)
- Parameters:
config- The configuration object specifying parameters for memory management.logger- An optional logger for debugging and tracking purposes.
-
-
Method Detail
-
createInMemory
InMemoryLruCache<Pair<Bitmap, File>> createInMemory()
Creates and returns an in-memory LRU cache for storing bitmaps.
The cache is lazily initialized and configured with a maximum size based on the MemoryConfig.
-
createDiskMemory
DiskMemory createDiskMemory()
Creates and returns a disk-based storage mechanism for persisting bitmaps.
The disk storage is lazily initialized and configured based on the MemoryConfig.
-
inMemorySize
Integer inMemorySize()
Calculates and returns the size of the in-memory cache in kilobytes.
The size is determined based on the MemoryConfig, choosing the larger value between the optimistic size and the minimum in-memory size.
-
freeInMemory
Unit freeInMemory()
Clears the in-memory cache, releasing all held bitmaps.
-
-
-
-