All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.swarm.arquillian.resolver.SimpleRepositoryCache Maven / Gradle / Ivy

package org.wildfly.swarm.arquillian.resolver;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.eclipse.aether.RepositoryCache;
import org.eclipse.aether.RepositorySystemSession;

/**
 * A simplistic repository cache backed by a thread-safe map. The simplistic nature of this cache makes it only suitable
 * for use with short-lived repository system sessions where pruning of cache data is not required.
 */
public final class SimpleRepositoryCache implements RepositoryCache {

    private final Map cache = new ConcurrentHashMap(256);

    public Object get(RepositorySystemSession session, Object key) {
        return cache.get(key);
    }

    public void put(RepositorySystemSession session, Object key, Object data) {
        if (data != null) {
            cache.put(key, data);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy