javax.cache.CacheLoader Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) 2011 Terracotta, Inc.
* Copyright (c) 2011 Oracle and/or its affiliates.
*
* All rights reserved. Use is subject to license terms.
*/
package javax.cache;
import java.util.Map;
/**
* Used for read-through caching and loading data into a cache.
*
* See {@link CacheWriter} which is the corollary for load used for write-through caching.
*
* @param the type of keys handled by this loader
* @param the type of values generated by this loader
* @author Greg Luck
* @author Yannis Cosmadopoulos
* @since 1.0
*/
public interface CacheLoader {
/**
* Loads an object. Application writers should implement this
* method to customize the loading of cache object. This method is called
* by the caching service when the requested object is not in the cache.
*
*
* @param key the key identifying the object being loaded
* @return The entry for the object that is to be stored in the cache.
*/
Cache.Entry load(K key);
/**
* Loads multiple objects. Application writers should implement this
* method to customize the loading of cache object. This method is called
* by the caching service when the requested object is not in the cache.
*
*
* @param keys keys identifying the values to be loaded
* @return A Map of objects that are to be stored in the cache.
*/
Map loadAll(Iterable extends K> keys);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy