Caches strings and provides lookup methods by raw character data to avoid string construction. It is intended to be used in various parsers to reduce memory footprint and garbage.
More...
|
| StringCache () |
| Creates a StringCache with default parameters. More...
|
|
| StringCache (int size) |
| Creates a StringCache with the specified number of elements and default bucket size. More...
|
|
| StringCache (int bucketNumber, int bucketSize) |
| Creates a StringCache with the specified number of buckets and their size. NOTE: cache uses linear search within each bucket, so do not use very large bucket sizes. More...
|
|
string | Get (string s) |
| Returns string from the cache that matches specified string. More...
|
|
string | Get (string s, bool copy) |
| Returns string from the cache that matches specified string. If copy parameter is true then specified string will be copied before being put to cache. More...
|
|
string | Get (string s, int offset, int length) |
| Returns string from the cache that matches specified character sequence. More...
|
|
string | Get (object charSequence) |
| Returns string from the cache that matches specified character sequence. More...
|
|
string | Get (char[] c) |
| Returns string from the cache that matches specified character sequence. More...
|
|
string | Get (char[] c, int offset, int length) |
| Returns string from the cache that matches specified character sequence. More...
|
|
override string | ToString () |
|
Caches strings and provides lookup methods by raw character data to avoid string construction. It is intended to be used in various parsers to reduce memory footprint and garbage.
The StringCache
is a N-way set associative cache which distributes all strings into buckets based on hash function and then uses LRU algorithm within each bucket. The StringCache
is a thread-safe, asynchronous, wait-free data structure.
◆ StringCache() [1/3]
com.dxfeed.util.StringCache.StringCache |
( |
| ) |
|
|
inline |
◆ StringCache() [2/3]
com.dxfeed.util.StringCache.StringCache |
( |
int |
size | ) |
|
|
inline |
Creates a StringCache
with the specified number of elements and default bucket size.
- Parameters
-
size | The number of elements. |
- Exceptions
-
System.ArgumentException | If parameters are not positive or result in too large cache. |
◆ StringCache() [3/3]
com.dxfeed.util.StringCache.StringCache |
( |
int |
bucketNumber, |
|
|
int |
bucketSize |
|
) |
| |
|
inline |
Creates a StringCache
with the specified number of buckets and their size. NOTE: cache uses linear search within each bucket, so do not use very large bucket sizes.
- Parameters
-
bucketNumber | The number of buckets. |
bucketSize | The size of each bucket. |
- Exceptions
-
System.ArgumentException | If parameters are not positive or result in too large cache. |
◆ Get() [1/6]
string com.dxfeed.util.StringCache.Get |
( |
string |
s | ) |
|
|
inline |
Returns string from the cache that matches specified string.
- Parameters
-
- Returns
◆ Get() [2/6]
string com.dxfeed.util.StringCache.Get |
( |
string |
s, |
|
|
bool |
copy |
|
) |
| |
|
inline |
Returns string from the cache that matches specified string. If copy
parameter is true
then specified string will be copied before being put to cache.
- Parameters
-
- Returns
◆ Get() [3/6]
string com.dxfeed.util.StringCache.Get |
( |
string |
s, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
|
inline |
Returns string from the cache that matches specified character sequence.
- Parameters
-
- Returns
◆ Get() [4/6]
string com.dxfeed.util.StringCache.Get |
( |
object |
charSequence | ) |
|
|
inline |
Returns string from the cache that matches specified character sequence.
- Parameters
-
- Returns
◆ Get() [5/6]
string com.dxfeed.util.StringCache.Get |
( |
char [] |
c | ) |
|
|
inline |
Returns string from the cache that matches specified character sequence.
- Parameters
-
- Returns
◆ Get() [6/6]
string com.dxfeed.util.StringCache.Get |
( |
char [] |
c, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
|
inline |
Returns string from the cache that matches specified character sequence.
- Parameters
-
- Returns
The documentation for this class was generated from the following file:
- dxf_api/src/util/StringCache.cs