Class StringCache
java.lang.Object
com.predic8.membrane.core.http.cookie.StringCache
- Author:
- Remy Maucherat
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static intAccess count.protected static StringCache.ByteEntry[]Cache for byte chunk.protected static inttoString count for byte chunk.protected static HashMap<StringCache.ByteEntry,int[]> Statistics hash map for byte chunk.protected static booleanEnabled ?protected static intprotected static StringCache.CharEntry[]Cache for char chunk.protected static inttoString count for char chunk.protected static HashMap<StringCache.CharEntry,int[]> Statistics hash map for char chunk.protected static booleanprotected static intHit count.protected static intprotected static int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static final intCompare given byte chunk with byte array.protected static final StringFind an entry given its name in the cache and return the associated String.protected static final intfindClosest(ByteChunk name, StringCache.ByteEntry[] array, int len) Find an entry given its name in a sorted array of map elements.intbooleanintbooleanintintvoidreset()voidsetByteEnabled(boolean byteEnabled) voidsetCacheSize(int cacheSize) voidsetCharEnabled(boolean charEnabled) voidsetTrainThreshold(int trainThreshold) static String
-
Field Details
-
byteEnabled
protected static boolean byteEnabledEnabled ? -
charEnabled
protected static boolean charEnabled -
trainThreshold
protected static int trainThreshold -
cacheSize
protected static int cacheSize -
maxStringSize
protected static int maxStringSize -
bcStats
Statistics hash map for byte chunk. -
bcCount
protected static int bcCounttoString count for byte chunk. -
bcCache
Cache for byte chunk. -
ccStats
Statistics hash map for char chunk. -
ccCount
protected static int ccCounttoString count for char chunk. -
ccCache
Cache for char chunk. -
accessCount
protected static int accessCountAccess count. -
hitCount
protected static int hitCountHit count.
-
-
Constructor Details
-
StringCache
public StringCache()
-
-
Method Details
-
getCacheSize
public int getCacheSize()- Returns:
- Returns the cacheSize.
-
setCacheSize
public void setCacheSize(int cacheSize) - Parameters:
cacheSize- The cacheSize to set.
-
getByteEnabled
public boolean getByteEnabled()- Returns:
- Returns the enabled.
-
setByteEnabled
public void setByteEnabled(boolean byteEnabled) - Parameters:
byteEnabled- The enabled to set.
-
getCharEnabled
public boolean getCharEnabled()- Returns:
- Returns the enabled.
-
setCharEnabled
public void setCharEnabled(boolean charEnabled) - Parameters:
charEnabled- The enabled to set.
-
getTrainThreshold
public int getTrainThreshold()- Returns:
- Returns the trainThreshold.
-
setTrainThreshold
public void setTrainThreshold(int trainThreshold) - Parameters:
trainThreshold- The trainThreshold to set.
-
getAccessCount
public int getAccessCount()- Returns:
- Returns the accessCount.
-
getHitCount
public int getHitCount()- Returns:
- Returns the hitCount.
-
reset
public void reset() -
toString
-
compare
Compare given byte chunk with byte array. Return -1, 0 or +1 if inferior, equal, or superior to the String. -
find
Find an entry given its name in the cache and return the associated String. -
findClosest
Find an entry given its name in a sorted array of map elements. This will return the index for the closest inferior or equal item in the given array.
-