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

io.github.portlek.sfs.caching.MapLookupCache Maven / Gradle / Ivy

There is a newer version: 5.7
Show newest version
package io.github.portlek.sfs.caching;

import io.github.portlek.sfs.Location;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

public class MapLookupCache implements LookupCache {

    ConcurrentHashMap> cache = new ConcurrentHashMap<>();

    @Override
    public List lookup(final long volumeId) {
        return this.cache.get(volumeId);
    }

    @Override
    public void invalidate(final long volumeId) {
        this.cache.remove(volumeId);
    }

    @Override
    public void invalidate() {
        this.cache = new ConcurrentHashMap<>();
    }

    @Override
    public void setLocation(final long volumeId, final List locations) {
        this.cache.put(volumeId, locations);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy