@Singleton public class ImageCacheSupplier extends Object implements com.google.common.base.Supplier<Set<? extends Image>>
This is a wrapper for the memoized image supplier (the actual image cache), to provide a way to register new images as
needed. Once a new image is created by the ImageExtension
, or discovered by
other means (see https://issues.apache.org/jira/browse/JCLOUDS-570) this supplier will allow the image to be appended
to the cached list, so it can be properly used normally.
Constructor and Description |
---|
ImageCacheSupplier(com.google.common.base.Supplier<Set<? extends Image>> imageCache,
long sessionIntervalSeconds) |
Modifier and Type | Method and Description |
---|---|
Set<? extends Image> |
get() |
void |
registerImage(Image image)
Registers a new image in the image cache.
|
public void registerImage(Image image)
This method should be called to register new images into the image cache, when some image that is known to exist in the provider is still not cached. For example, this can happen when an image is created after the image cache has been populated for the first time.
Note that this method does not check if the image is already cached, to avoid loading all images if the image cache is still not populated.
image
- The image to be registered to the cache.Copyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.