cloud.eppo.cache.LRUInMemoryAssignmentCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-common-jvm Show documentation
Show all versions of sdk-common-jvm Show documentation
Eppo SDK for JVM shared library
package cloud.eppo.cache;
import cloud.eppo.api.AbstractAssignmentCache;
import java.util.Collections;
import org.apache.commons.collections4.map.LRUMap;
/**
* A cache that uses the LRU algorithm to evict the least recently used items.
*
* The primary use case is for server-side SDKs, where the cache is shared across multiple users.
*/
public class LRUInMemoryAssignmentCache extends AbstractAssignmentCache {
public LRUInMemoryAssignmentCache(int maxSize) {
// Synchronized wrapper for thread safety
super(Collections.synchronizedMap(new LRUMap<>(maxSize)));
}
}