Code example for ConcurrentMap

Methods: put

    public synchronized ValT put(KeyT key, ValT value) {
        if (isDiskCacheEnabled) {
            cacheToDisk(key, value);
        return cache.put(key, value);
    public synchronized void putAll(Map<? extends KeyT, ? extends ValT> t) {
        throw new UnsupportedOperationException();
     * Checks if a value is present in the cache. If the disk cached is enabled, this will also 
     * check whether the value has been persisted to disk. 
     * @param key 
     *            the cache key 
     * @return true if the value is cached in memory or on disk, false otherwise