Package com.tangosol.net.cache
Class BinaryMemoryCalculator
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.cache.SimpleMemoryCalculator
com.tangosol.net.cache.BinaryMemoryCalculator
- All Implemented Interfaces:
- ConfigurableCacheMap.UnitCalculator,- OldCache.UnitCalculator
A UnitCalculator implementation that weighs a cache entry based upon the
 amount of physical memory (in bytes) required to store the entry.
 
 This implementation can only determine an accurate entry size if both the
 entry key and value are Binary objects; otherwise, an exception will
 be thrown during the unit calculation.
- Author:
- jh 2005.12.14
- 
Nested Class SummaryNested classes/interfaces inherited from class com.tangosol.util.BaseBase.LoggingWriter
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final BinaryMemoryCalculatorSingleton BinaryMemoryCalculator instance.Fields inherited from class com.tangosol.net.cache.SimpleMemoryCalculatorMAP_FIXED_SIZES, MAP_PRIMITIVE_SIZES, SIZE_BASIC_OBJECT, SIZE_BIGDECIMAL, SIZE_BIGINTEGER, SIZE_BINARY, SIZE_BOOLEAN, SIZE_BYTE, SIZE_CHARACTER, SIZE_DATE, SIZE_DOUBLE, SIZE_ENTRY, SIZE_FLOAT, SIZE_INTEGER, SIZE_LONG, SIZE_OBJECT, SIZE_OBJECT_REF, SIZE_SHORT, SIZE_STRING, SIZE_TIMESTAMP
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintcalculateUnits(Object oKey, Object oValue) Calculate the approximate number of bytes required to cache the given Binary key and value.static voidUnit test.Methods inherited from class com.tangosol.net.cache.SimpleMemoryCalculatorcalculateShallowSize, getEntrySize, getName, isInnerClass, padMemorySize, sizeOf, sizeOfMethods inherited from class com.tangosol.util.Baseazzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
- 
Field Details- 
INSTANCESingleton BinaryMemoryCalculator instance.
 
- 
- 
Constructor Details- 
BinaryMemoryCalculatorpublic BinaryMemoryCalculator()
 
- 
- 
Method Details- 
calculateUnitsCalculate the approximate number of bytes required to cache the given Binary key and value.- Specified by:
- calculateUnitsin interface- ConfigurableCacheMap.UnitCalculator
- Overrides:
- calculateUnitsin class- SimpleMemoryCalculator
- Parameters:
- oKey- the key
- oValue- the value
- Returns:
- the number of bytes of memory necessary to cache the given key and value
 
- 
mainUnit test.Usage: java com.tangosol.net.cache.BinaryMemoryCalculator - Parameters:
- asArg- command line arguments
 
 
-