Package 

Class ModelCache


  • 
    public class ModelCache<A, B>
    
                        

    A simple cache that can be used by ModelLoader and ModelLoaderFactory to cache some data for a given model, width and height. For a loader that takes a model and returns a url, the cache could be used to safely memoize url creation based on the width and height of the view.

    • Method Summary

      Modifier and Type Method Description
      B get(A model, int width, int height) Get a value.
      void put(A model, int width, int height, B value) Add a value.
      void clear() Removes all entries from the cache.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModelCache

        ModelCache()
      • ModelCache

        ModelCache(long size)
    • Method Detail

      • get

        @Nullable() B get(A model, int width, int height)

        Get a value.

        Parameters:
        model - The model.
        width - The width in pixels of the view the image is being loaded into.
        height - The height in pixels of the view the image is being loaded into.
      • put

         void put(A model, int width, int height, B value)

        Add a value.

        Parameters:
        model - The model.
        width - The width in pixels of the view the image is being loaded into.
        height - The height in pixels of the view the image is being loaded into.
        value - The value to store.
      • clear

         void clear()

        Removes all entries from the cache.