Class SoftCacheWeakIdentityMap

  • All Implemented Interfaces:
    Serializable, Cloneable, IdentityMap

    public class SoftCacheWeakIdentityMap
    extends HardCacheWeakIdentityMap

    Purpose: A SoftCacheWeakIdentityMap is identical to the WeakIdentityMap, however the weak reference can be a performance problem for some types of apps because it can cause too much garbage collection of objects read causing them to be re-read and re-built (this defeats the purpose of the cache). The SoftCacheWeakIdentityMap solves this through also holding a fixed number of objects in memory to improve caching.

    Responsibilities:

    • Guarantees identity
    • Allows garbage collection
    • Increases performance by maintaining a fixed size cache of MRU objects when memory is available.
    • The default size of the reference cache is the max size.
    Since:
    TOPLink/Java 1.2
    See Also:
    Serialized Form
    • Constructor Detail

    • Method Detail

      • hasReference

        public boolean hasReference​(Object reference)
        Checks if the object is null, or reference's object is null.
        Overrides:
        hasReference in class HardCacheWeakIdentityMap
        Parameters:
        reference - the object for hard or the reference for soft.