Interface CacheLoader

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface CacheLoader
    extends java.lang.AutoCloseable
    CacheLoader Interface implementation is needed to be provided at cache server in order to load items in the cache on cache initialization.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​RefreshPreference> getDatasetsToRefresh​(java.util.Map<java.lang.String,​java.lang.Object> userContexts)
      Responsible for getting new datasets at realtime through polling if refresh-on-event is enabled.
      void init​(java.util.Map<java.lang.String,​java.lang.String> parameters, java.lang.String cacheName)
      Perform tasks like allocating resources or acquiring connections etc.
      java.lang.Object loadDatasetOnStartup​(java.lang.String dataset)
      Responsible for loading of items on cache startup.
      java.lang.Object refreshDataset​(java.lang.String dataset, java.lang.Object userContext)
      Responsible for refreshing of items.
      • Methods inherited from interface java.lang.AutoCloseable

        close
    • Method Detail

      • init

        void init​(java.util.Map<java.lang.String,​java.lang.String> parameters,
                  java.lang.String cacheName)
           throws java.lang.Exception
        Perform tasks like allocating resources or acquiring connections etc.
        Parameters:
        parameters - Startup parameters defined in the configuration.
        cacheName - Cache name for which loader is called.
        Throws:
        java.lang.Exception
      • loadDatasetOnStartup

        java.lang.Object loadDatasetOnStartup​(java.lang.String dataset)
                                       throws java.lang.Exception
        Responsible for loading of items on cache startup.
        Parameters:
        dataset - dataset for which loader is called.
        Returns:
        The usercontext can be any custom object that is needed by the user during refresh call.
        Throws:
        java.lang.Exception
      • refreshDataset

        java.lang.Object refreshDataset​(java.lang.String dataset,
                                        java.lang.Object userContext)
                                 throws java.lang.Exception
        Responsible for refreshing of items.
        Parameters:
        dataset - dataset for which loader is called.
        userContext - The usercontext associated with the specified dataset.
        Returns:
        The usercontext can be any custom object that is needed by the user during refresh call.
        Throws:
        java.lang.Exception
      • getDatasetsToRefresh

        java.util.Map<java.lang.String,​RefreshPreference> getDatasetsToRefresh​(java.util.Map<java.lang.String,​java.lang.Object> userContexts)
                                                                              throws java.lang.Exception
        Responsible for getting new datasets at realtime through polling if refresh-on-event is enabled.
        Parameters:
        userContexts - Map that contains the dataset and the associated user-context as key value pairs.
        Returns:
        Map that contains the dataset that needs to be updated and the corresponding refresh preferences.
        Throws:
        java.lang.Exception