Nativescript UI/image-cache


#1

Hi
i am trying image cache using the ui/image-cache module.
The cache.push() works fine.but when i go to another component and use the cache.get(url) i am getting null object.is it and issue with the module.

cache.placeholder = imageSource.fromFile(fs.path.join(__dirname, "res/no-image.png"));
cache.maxRequests = 5;

// Enable download while not scrolling
cache.enableDownload();

var imgSouce: imageSource.ImageSource;
var url = "https://github.com/NativeScript.png";
// Try to read the image from the cache
var image = cache.get(url);
if (image) {
    // If present -- use it.
    imgSouce = imageSource.fromNativeSource(image);
}
else {
    // If not present -- request its download.
    cache.push({
        key: url,
        url: url,
        completed: (image: any, key: string) => {
            if (url === key) {
                imgSouce = imageSource.fromNativeSource(image);
            }
        }
    });
}

// Disable download while scrolling
cache.disableDownload();```