| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| private int | |
| private int | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public boolean | Returns: true if the cache contains (or contained) a value associated with the given key.a string that might have a value associated to it. input)Tests whether the cache contains the given key |
| public T | |
| public int | Returns: the maximum length aString key can haveReturns the maximum length a |
| public int | Returns: the maximum number of entries that can be stored in this string cache.Returns the size limit of this string cache. |
| protected abstract T | |
| public void | |
| public void | setMaxStringLength(int
the maximum length a maxStringLength)String key can haveReturns the maximum length a |
| public void | setSizeLimit(int
the maximum number of entries that can be stored in this string cache. sizeLimit)Defines the size limit of this string cache (16,384 by default). |
| DEFAULT_MAX_STRING_LENGTH | back to summary |
|---|---|
| private static final int DEFAULT_MAX_STRING_LENGTH | |
| DEFAULT_SIZE_LIMIT | back to summary |
|---|---|
| private static final int DEFAULT_SIZE_LIMIT | |
| maxStringLength | back to summary |
|---|---|
| private int maxStringLength | |
| sizeLimit | back to summary |
|---|---|
| private int sizeLimit | |
| stringCache | back to summary |
|---|---|
| private final Map<String, SoftReference<T>> stringCache | |
| StringCache | back to summary |
|---|---|
| public StringCache() | |
| clear | back to summary |
|---|---|
| public void clear() Removes all entries stored in this cache. | |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(String input) Tests whether the cache contains the given key
| |
| get | back to summary |
|---|---|
| public T get(String input) Returns the value associated with the given string. If it doesn't exist,
or if it has been evicted, a value will be populated using
| |
| getMaxStringLength | back to summary |
|---|---|
| public int getMaxStringLength() Returns the maximum length a
| |
| getSizeLimit | back to summary |
|---|---|
| public int getSizeLimit() Returns the size limit of this string cache. Defaults to 16,384. For simplicity, when this limit is reached, the entire cache is cleared.
| |
| process | back to summary |
|---|---|
| protected abstract T process(String input) Converts a given string to a value
| |
| put | back to summary |
|---|---|
| public void put(String input, T value) Associates a value to a string
| |
| setMaxStringLength | back to summary |
|---|---|
| public void setMaxStringLength(int maxStringLength) Returns the maximum length a
| |
| setSizeLimit | back to summary |
|---|---|
| public void setSizeLimit(int sizeLimit) Defines the size limit of this string cache (16,384 by default). For simplicity, when this limit is reached, the entire cache is cleared.
| |