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

com.maxifier.mxcache.AbstractCacheContext Maven / Gradle / Ivy

/*
 * Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
 */
package com.maxifier.mxcache;

import com.maxifier.mxcache.context.CacheContext;
import gnu.trove.map.hash.THashMap;

import java.util.Map;

/**
 * @author Alexander Kochurov ([email protected])
 */
public abstract class AbstractCacheContext implements CacheContext {
    private final Map cache = new THashMap();

    @SuppressWarnings("unchecked")
    @Override
    public synchronized  T getRelated(ContextRelatedItem item) {
        return (T) cache.get(item);
    }

    @Override
    public synchronized  void setRelated(ContextRelatedItem item, T value) {
        cache.put(item, value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy