org.apache.http.impl.client.cache

## Class DefaultFailureCache

- java.lang.Object
- - org.apache.http.impl.client.cache.DefaultFailureCache

All Implemented Interfaces:
  FailureCache

    @Contract(threading=SAFE)
    public class DefaultFailureCache
    extends Object
    implements FailureCache

Implements a bounded failure cache. The oldest entries are discarded when the maximum size is exceeded.

Since:
  4.3

### Constructor Summary

Constructors
Constructor and Description
`DefaultFailureCache()` Create a new failure cache with the maximum size of `DEFAULT_MAX_SIZE`.
`DefaultFailureCache(int maxSize)` Creates a new failure cache with the specified maximum size.

### Method Summary

Methods
`int` `getErrorCount(String identifier)` Get the current error count.
`void` `increaseErrorCount(String identifier)` Increases the error count by one.
`void` `resetErrorCount(String identifier)` Reset the error count back to zero.

### Methods inherited from class java.lang.Object

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

### Constructor Detail

#### DefaultFailureCache

    public DefaultFailureCache()

Create a new failure cache with the maximum size of `DEFAULT_MAX_SIZE`.

#### DefaultFailureCache

    public DefaultFailureCache(int maxSize)

Creates a new failure cache with the specified maximum size.

Parameters:
  `maxSize` - the maximum number of entries the cache should store

### Method Detail

#### getErrorCount

    public int getErrorCount(String identifier)

Description copied from interface: `FailureCache`
Get the current error count.

Specified by:
  `getErrorCount` in interface `FailureCache`
Parameters:
  `identifier` - the identifier for which the error count is requested
Returns:
  the currently known error count or zero if there is no record

#### resetErrorCount

    public void resetErrorCount(String identifier)

Description copied from interface: `FailureCache`
Reset the error count back to zero.

Specified by:
  `resetErrorCount` in interface `FailureCache`
Parameters:
  `identifier` - the identifier for which the error count should be reset

#### increaseErrorCount

    public void increaseErrorCount(String identifier)

Description copied from interface: `FailureCache`
Increases the error count by one.

Specified by:
  `increaseErrorCount` in interface `FailureCache`
Parameters:
  `identifier` - the identifier for which the error count should be increased