Class CacheableOptional<T extends Serializable>

  • All Implemented Interfaces:
    Serializable, Cacheable

    public class CacheableOptional<T extends Serializable>
    extends Object
    implements Cacheable
    Some times it is desirable to store in a Cache the absence of a value. Unfortunately, it's not possible to store a null value in a clustered cache because of the underlying hazelcast technology used for clustering. The obvious candidate would therefore be to store an Optional object in the cache instead - unfortunately an Optional is not serializable. This class therefore performs this functionality - an optional value that is cacheable.
    See Also:
    Serialized Form