Package jetbrains.buildServer.util.cache
Class EhCacheUtilBase
- java.lang.Object
-
- jetbrains.buildServer.util.cache.EhCacheUtilBase
-
- All Implemented Interfaces:
EhCacheHelper
- Direct Known Subclasses:
EhCacheUtil
public class EhCacheUtilBase extends Object implements EhCacheHelper
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 EhCacheUtil cacheUtil) { myCache = cacheUtil.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.- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMPACT_ENABLED_PROPERTY
static String
COMPACT_MIN_PERIOD_PROPERTY
static String
COMPACT_TRIGGER_SIZE_PROPERTY
-
Constructor Summary
Constructors Constructor Description EhCacheUtilBase(EhCacheUtilPaths serverPaths, ResetCacheRegister register)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description net.sf.ehcache.Cache
createCache(String name)
net.sf.ehcache.Cache
createCache(String configText, String name, Map<String,String> params)
net.sf.ehcache.Cache
createInMemoryCache(String name)
boolean
destroyCache(String name)
Destroys cache with specified name - disposes cache and removes all its data including files stored on disk if cache is persistent.void
disposeCache(String name)
Disposes (flushes on disk and frees resources) a cache with given nameprotected net.sf.ehcache.CacheManager
getCacheManager(String configText, Map<String,String> cacheParams)
void
shutdownCaches()
-
-
-
Field Detail
-
COMPACT_ENABLED_PROPERTY
public static final String COMPACT_ENABLED_PROPERTY
- See Also:
- Constant Field Values
-
COMPACT_TRIGGER_SIZE_PROPERTY
public static final String COMPACT_TRIGGER_SIZE_PROPERTY
- See Also:
- Constant Field Values
-
COMPACT_MIN_PERIOD_PROPERTY
public static final String COMPACT_MIN_PERIOD_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EhCacheUtilBase
public EhCacheUtilBase(@NotNull EhCacheUtilPaths serverPaths, @NotNull ResetCacheRegister register)
-
-
Method Detail
-
shutdownCaches
public void shutdownCaches()
-
getCacheManager
@Nullable protected net.sf.ehcache.CacheManager getCacheManager(@NotNull String configText, @NotNull Map<String,String> cacheParams)
-
createCache
@NotNull public net.sf.ehcache.Cache createCache(@NotNull String configText, @NotNull String name, @NotNull Map<String,String> params)
-
createCache
@NotNull public net.sf.ehcache.Cache createCache(@NotNull String name)
- Specified by:
createCache
in interfaceEhCacheHelper
-
createInMemoryCache
@NotNull public net.sf.ehcache.Cache createInMemoryCache(@NotNull String name)
- Specified by:
createInMemoryCache
in interfaceEhCacheHelper
-
disposeCache
public void disposeCache(@NotNull String name)
Description copied from interface:EhCacheHelper
Disposes (flushes on disk and frees resources) a cache with given name- Specified by:
disposeCache
in interfaceEhCacheHelper
-
destroyCache
public boolean destroyCache(@NotNull String name)
Description copied from interface:EhCacheHelper
Destroys cache with specified name - disposes cache and removes all its data including files stored on disk if cache is persistent.- Specified by:
destroyCache
in interfaceEhCacheHelper
- Parameters:
name
- cache name- Returns:
- true if cache destroyed, and false some error occurred and cache could not be destroyed
-
-