As pointed out by genman, the use of InternalCacheEntries (ICEs) in
certain cache stores can lead to unnecessary marshalling of a key
twice, impacting both time to marshall and space consumed by the
resulting byte stream.
Cache stores specifically affected are the JdbcStringBasedCacheStore,
BdbjeCacheStore, JdbmCacheStore and ClusteredCacheLoader.
The ClusteredGetCommand - used by both the ClusteredCacheLoader as
well as the DistributionInterceptor for remote lookups - is also
affected. There is no point in a remote host marshalling the key in
ICE as a part of the response stream, the caller already has the key
as it was a part of the request.
All the same, we cannot remove the key portion of ICE or exclude it
from marshalling as it is needed for other purposes such as state
transfer. Bucket-based cache stores too require the key to be stored
with the entry.
So to work around this, I have provided an additional interface:
InternalCacheValue (ICV). This is a representation of a value (+ any
information pertaining to expiry). So essentially all the stuff in an
ICE minus the key.
An ICV is obtained by invoking ICE.toInternalCacheValue(). The cache
stores mentioned above - and ClusteredGetCommand - should make sure
they marshall ICVs rather than ICEs.
When loading entries, an ICE can be created by using
ICV.toInternalCacheEntry(Object key).
Could the respective authors of the stores above please modify their
code accordingly - I've just checked in the ICV changes in trunk.
Cheers
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org