Interface EntityCache

  • All Known Implementing Classes:
    DefaultEntityCache

    public interface EntityCache
    A primarily internal class used by MorphiaIterator to track entities loaded from mongo to prevent multiple loads of objects when keys are seen multiple times in a query result.
    • Method Detail

      • exists

        java.lang.Boolean exists​(Key<?> k)
        Looks for a Key in the cache
        Parameters:
        k - the Key to search for
        Returns:
        true if the Key is found
      • flush

        void flush()
        Clears the cache
      • getEntity

        <T> T getEntity​(Key<T> k)
        Returns the entity for a Key
        Type Parameters:
        T - the type of the entity
        Parameters:
        k - the Key to search for
        Returns:
        the entity
      • getProxy

        <T> T getProxy​(Key<T> k)
        Returns a proxy for the entity for a Key
        Type Parameters:
        T - the type of the entity
        Parameters:
        k - the Key to search for
        Returns:
        the proxy
      • notifyExists

        void notifyExists​(Key<?> k,
                          boolean exists)
        Notifies the cache of the existence of a Key
        Parameters:
        k - the Key
        exists - true if the Key represents an existing entity
      • putEntity

        <T> void putEntity​(Key<T> k,
                           T t)
        Adds an entity to the cache
        Type Parameters:
        T - the type of the entity
        Parameters:
        k - the Key of the entity
        t - the entity
      • putProxy

        <T> void putProxy​(Key<T> k,
                          T t)
        Adds a proxy to the cache
        Type Parameters:
        T - the type of the entity
        Parameters:
        k - the Key of the entity
        t - the proxy