public boolean put(Locator locator, String key, String value) throws CacheException {
        if (value == null) return false;

        Timer.Context cachePutTimerContext = MetadataCache.cachePutTimer.time();
        boolean dbWrite = false;
        try {
            CacheKey cacheKey = new CacheKey(locator, key);
            String oldValue = cache.getIfPresent(cacheKey);
            // don't care if oldValue == EMPTY.
            // always put new value in the cache. it keeps reads from happening.
            cache.put(cacheKey, value);
            if (oldValue == null || !oldValue.equals(value)) {
                dbWrite = true;
            }

            if (dbWrite) {
                updatedMetricMeter.mark();
                if (!batchedWrites) {
                    databasePut(locator, key, value);
                } else {
                    databaseLazyWrite(locator, key);
                }
            }

            return dbWrite;
        } finally {
            cachePutTimerContext.stop();
        }
    }
public boolean put(Locator locator, String key, String value) throws CacheException {
        if (value == null) return false;

        Timer.Context cachePutTimerContext = MetadataCache.cachePutTimer.time();
        boolean dbWrite = false;
        try {
            CacheKey cacheKey = new CacheKey(locator, key);
            String oldValue = cache.getIfPresent(cacheKey);
            
            
            cache.put(cacheKey, value);
            if (oldValue == null || !oldValue.equals(value)) {
                dbWrite = true;
            }

            if (dbWrite) {
                updatedMetricMeter.mark();
                if (!batchedWrites) {
                    databasePut(locator, key, value);
                } else {
                    databaseLazyWrite(locator, key);
                }
            }

            return dbWrite;
        } finally {
            cachePutTimerContext.stop();
        }
    }
public boolean put ( Locator locator , String key , String value ) throws CacheException { if ( value == null ) return false ; Timer . Context cachePutTimerContext = MetadataCache . cachePutTimer . time ( ) ; boolean dbWrite = false ; try { CacheKey cacheKey = new CacheKey ( locator , key ) ; String oldValue = cache . getIfPresent ( cacheKey ) ; // don't care if oldValue == EMPTY. // always put new value in the cache. it keeps reads from happening. cache . put ( cacheKey , value ) ; if ( oldValue == null || ! oldValue . equals ( value ) ) { dbWrite = true ; } if ( dbWrite ) { updatedMetricMeter . mark ( ) ; if ( ! batchedWrites ) { databasePut ( locator , key , value ) ; } else { databaseLazyWrite ( locator , key ) ; } } return dbWrite ; } finally { cachePutTimerContext . stop ( ) ; } }
returns true if updated.
returns true if updated .