dxFeed .Net API  7.1.0
dxFeed .Net API library intended to provide market data access for DX clients
com.dxfeed.util.StringCache Class Reference

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...

Public Member Functions

 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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ StringCache() [1/3]

com.dxfeed.util.StringCache.StringCache ( )
inline

Creates a StringCache with default parameters.

◆ 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
sizeThe number of elements.
Exceptions
System.ArgumentExceptionIf 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
bucketNumberThe number of buckets.
bucketSizeThe size of each bucket.
Exceptions
System.ArgumentExceptionIf parameters are not positive or result in too large cache.

Member Function Documentation

◆ Get() [1/6]

string com.dxfeed.util.StringCache.Get ( string  s)
inline

Returns string from the cache that matches specified string.

Parameters
s
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
s
copy
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
s
offset
length
Returns

◆ Get() [4/6]

string com.dxfeed.util.StringCache.Get ( object  charSequence)
inline

Returns string from the cache that matches specified character sequence.

Parameters
charSequence
Returns

◆ Get() [5/6]

string com.dxfeed.util.StringCache.Get ( char []  c)
inline

Returns string from the cache that matches specified character sequence.

Parameters
c
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
c
offset
length
Returns

The documentation for this class was generated from the following file: