# Class CachingStatCalculator

java.lang.Object
org.apache.jmeter.visualizers.SamplingStatCalculator
org.apache.jmeter.visualizers.CachingStatCalculator

public class CachingStatCalculator extends SamplingStatCalculator
Provides storage of samples in addition to calculations

## Constructor Summary

Constructors
Constructor
Description
`CachingStatCalculator(String string)`

## Method Summary

Modifier and Type
Method
Description
`Sample`
`addSample(SampleResult res)`
Records a sample.
`void`
`clear()`
Clear the counters (useful for differential stats)
`Sample`
`getSample(int index)`
`List<Sample>`
`getSamples()`

### Methods inherited from class SamplingStatCalculator

`getAvgPageBytes, getBytesPerSecond, getCount, getCurrentSample, getDistribution, getElapsed, getErrorCount, getErrorPercentage, getKBPerSecond, getLabel, getMax, getMaxThroughput, getMean, getMeanAsNumber, getMedian, getMin, getPercentPoint, getPercentPoint, getRate, getStandardDeviation, toString`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### CachingStatCalculator

public CachingStatCalculator(String string)

## Method Details

### getSamples

public List<Sample> getSamples()

### getSample

public Sample getSample(int index)

### clear

public void clear()
Description copied from class: `SamplingStatCalculator`
Clear the counters (useful for differential stats)

Overrides:
  `clear` in class `SamplingStatCalculator`

### addSample

public Sample addSample(SampleResult res)
Records a sample.

Overrides:
  `addSample` in class `SamplingStatCalculator`
Parameters:
  `res` - the sample to record
Returns:
  newly created sample with current statistics