Package io.deephaven.base.string.cache
Interface StringCache<STRING_LIKE_TYPE extends CharSequence>
- All Known Implementing Classes:
AlwaysCreateStringCache
,ConcurrentBoundedStringCache
,ConcurrentUnboundedStringCache
,OpenAddressedWeakUnboundedStringCache
public interface StringCache<STRING_LIKE_TYPE extends CharSequence>
Generic caching interface for Strings and String-like CharSequences.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
Get a hint about this cache's capacity and behavior.getCachedString
(@NotNull StringCompatible protoString) default STRING_LIKE_TYPE
getCachedString
(@NotNull CharSequence charSequence) Convenience method to allow arbitrary CharSequence references to be used in lookup.getCachedString
(@NotNull String string) @NotNull Class<STRING_LIKE_TYPE>
getType()
-
Field Details
-
CAPACITY_UNBOUNDED
static final int CAPACITY_UNBOUNDED- See Also:
-
-
Method Details
-
capacity
int capacity()Get a hint about this cache's capacity and behavior.- Returns:
- -1 : This is an unbounded cache. 0 : This "cache" doesn't actually perform any caching. >0 : Actual capacity bound.
-
getType
- Returns:
- The type of the elements in this cache.
-
getEmptyString
- Returns:
- A cached STRING_LIKE_TYPE that represents the empty string.
-
getCachedString
- Parameters:
protoString
- The string-like CharSequence to look up- Returns:
- A cached STRING_LIKE_TYPE that corresponds to the current value of the CharSequence expressed by protoString
-
getCachedString
- Parameters:
string
- The String to look up- Returns:
- A cached STRING_LIKE_TYPE that corresponds to the CharSequence expressed by string
-
getCachedString
Convenience method to allow arbitrary CharSequence references to be used in lookup.- Parameters:
charSequence
- The CharSequence to look up- Returns:
- A cached STRING_LIKE_TYPE that corresponds to charSequence
-