
sirius.kernel.cache.ValueComputer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sirius-kernel Show documentation
Show all versions of sirius-kernel Show documentation
Provides common core classes and the microkernel powering all Sirius applications
/*
* Made with all the love in the world
* by scireum in Remshalden, Germany
*
* Copyright by scireum GmbH
* http://www.scireum.de - [email protected]
*/
package sirius.kernel.cache;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Computes a value if it is not found in a cache
*
* Can be supplied to {@link CacheManager#createLocalCache(String, ValueComputer, ValueVerifier)} or
* {@link CacheManager#createCoherentCache(String, ValueComputer, ValueVerifier)} when creating a cache to compute
* values which are not found in the cache.
*
* @param the key type determining the type of the lookup values in the cache
* @param the value type determining the type of values stored in the cache
*/
public interface ValueComputer {
/**
* Computes the value for the given key
*
* @param key the key which was used to lookup a value in the cache
* @return the appropriate value to be cached for the given key
*/
@Nullable
V compute(@Nonnull K key);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy