@Override
    public int getCachedSize() throws CannotCalculateSizeException {
        final int sizeOfValue = CacheSizes.sizeOfAnything(value);
        if (value == null) {
            // 94 bytes seems to be the overhead of a CacheableOptional representing absent value
            return 94 + sizeOfValue;
        } else {
            // 72 bytes seems to be the overhead of a CacheableOptional<String> representing present value
            return 72 + CacheSizes.sizeOfString(value.getClass().getName()) + sizeOfValue;
        }
    }
Some times it is desirable to store in a {@link org.jivesoftware.util.cache.Cache} the absence of a value.
Unfortunately, it's not possible to store a {@code null} value in a clustered cache because of the underlying hazelcast
technology used for clustering. The obvious candidate would therefore be to store an {@link Optional} object in the
cache instead - unfortunately an Optional is not serializable. This class therefore performs this functionality - an
optional value that is cacheable.
xmppserver/src/main/java/org/jivesoftware/util/CacheableOptional.java