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

org.ikasan.dashboard.security.ContextCache Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
package org.ikasan.dashboard.security;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

import java.util.concurrent.TimeUnit;

public class ContextCache {
    private static Cache CONTEXT_CACHE;

    static {
        CONTEXT_CACHE = CacheBuilder.newBuilder()
            .expireAfterWrite(5, TimeUnit.MINUTES)
            .build();
    }

    public static void addContext(String id, String context) {
        CONTEXT_CACHE.put(id, context);
    }

    public static String getContext(String id) {
        String context =  CONTEXT_CACHE.getIfPresent(id);

        return context;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy