Interface CacheLoader

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface CacheLoader
    extends java.lang.AutoCloseable
    CacheLoader interface implementation needs to be provided at the cache server in order to load items to the cache on the 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 real-time 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)
      This method loads item in dataset on cache startup.
      java.lang.Object refreshDataset​(java.lang.String dataset, java.lang.Object userContext)
      Responsible for refreshing items in dataset.
      • 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. Through these parameters, user can specify runtime parameters to the deployed provider like connection string, 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
        This method loads item in dataset on cache startup.
        Parameters:
        dataset - Dataset for which loader is called.
        Returns:
        Result of loading dataset.
        Throws:
        java.lang.Exception
      • refreshDataset

        java.lang.Object refreshDataset​(java.lang.String dataset,
                                        java.lang.Object userContext)
                                 throws java.lang.Exception
        Responsible for refreshing items in dataset.
        Parameters:
        dataset - Dataset to refresh.
        userContext - User context object to verify which data needs to refresh.
        Returns:
        Result of dataset refresh.
        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 real-time 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