Interface EhCacheHelper

  • All Known Implementing Classes:
    EhCacheUtil, EhCacheUtilBase

    public interface EhCacheHelper
    This is a helper class to access a EhCache disk persisted cache on the server. A helper class designed to simplify the work with EhCache library. See the doc for more details.

    Typical usage:

       public MyBean {
         private Cache myCache;
         public MyBean(@NotNull EhCacheHelper cacheHelper) {
           myCache = cacheHelper.createCache("my-cache-name");
         }
         ...
       }
     

    Note: if your cache is not eternal (in ehcache configuration), it will be cleaned up if requested from admin interface or API. Default cache not eternal. (replacement for closed-api EhCacheHelper class.) TODO: Get rid of EhCache public dependency!

    Since:
    8.0
    Author:
    Maxim Podkolzine (maxim.podkolzine@jetbrains.com), Eugene Petrenko (eugene.Petrenko@jetbrains.com)
    • Method Detail

      • createCache

        @NotNull
        net.sf.ehcache.Cache createCache​(@NotNull
                                         String name)
      • createInMemoryCache

        @NotNull
        net.sf.ehcache.Cache createInMemoryCache​(@NotNull
                                                 String name)
      • disposeCache

        void disposeCache​(@NotNull
                          String name)
        Disposes (flushes on disk and frees resources) a cache with given name
        Parameters:
        name -
      • destroyCache

        boolean destroyCache​(@NotNull
                             String name)
        Destroys cache with specified name - disposes cache and removes all its data including files stored on disk if cache is persistent.
        Parameters:
        name - cache name
        Returns:
        true if cache destroyed, and false some error occurred and cache could not be destroyed