public int getCacheHits(String componentName) {
    switchLock.acquireReadLock();
    try {
      if (enabled) {
        final PerformanceCountersHolder countersHolder = ComponentType.GENERAL.newCountersHolder();
        fetchComponentCounters(componentName, countersHolder);
        return countersHolder.getCacheHits();
      } else {
        final ImmutableStatistic post = postMeasurementStatistic;
        if (post == null)
          return -1;

        final PerformanceCountersHolder holder = post.countersByComponents.get(componentName);
        if (holder != null)
          return holder.getCacheHits();

        return -1;
      }
    } finally {
      switchLock.releaseReadLock();
    }
  }
public int getCacheHits(String componentName) {
    switchLock.acquireReadLock();
    try {
      if (enabled) {
        final PerformanceCountersHolder countersHolder = ComponentType.GENERAL.newCountersHolder();
        fetchComponentCounters(componentName, countersHolder);
        return countersHolder.getCacheHits();
      } else {
        final ImmutableStatistic post = postMeasurementStatistic;
        if (post == null)
          return -1;

        final PerformanceCountersHolder holder = post.countersByComponents.get(componentName);
        if (holder != null)
          return holder.getCacheHits();

        return -1;
      }
    } finally {
      switchLock.releaseReadLock();
    }
  }
public int getCacheHits ( String componentName ) { switchLock . acquireReadLock ( ) ; try { if ( enabled ) { final PerformanceCountersHolder countersHolder = ComponentType . GENERAL . newCountersHolder ( ) ; fetchComponentCounters ( componentName , countersHolder ) ; return countersHolder . getCacheHits ( ) ; } else { final ImmutableStatistic post = postMeasurementStatistic ; if ( post == null ) return - 1 ; final PerformanceCountersHolder holder = post . countersByComponents . get ( componentName ) ; if ( holder != null ) return holder . getCacheHits ( ) ; return - 1 ; } } finally { switchLock . releaseReadLock ( ) ; } }
Percent of cache hits for component name of which is passed as method argument. If null value is passed then value for whole
system will be returned. If data for component with passed in name does not exist then <code>-1</code> will be returned.

@param componentName Name of component data of which should be returned. Name is case sensitive.

@return Percent of cache hits or value which is less than 0, which means that value cannot be calculated.
Percent of cache hits for component name of which is passed as method argument . If null value is passed then value for whole system will be returned . If data for component with passed in name does not exist then <code > - 1< / code > will be returned .