Package jetbrains.buildServer.util.cache
Class SCacheImpl<T>
- java.lang.Object
-
- jetbrains.buildServer.util.cache.SCacheImpl<T>
-
-
Constructor Summary
Constructors Constructor Description SCacheImpl(net.sf.ehcache.Cache storage, int timeToLive, int timeToIdle, Class<T> cachedItemsClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddestroy()Same asSCache.invalidateAll().abstract voiddispose()Flushes data on disk (if cache is persistable) and frees all of the resources associated with this cache.Tfetch(String key, Calculator<T> dataFetcher)Get data from cache, if available.voidflush()Flush all the cache data to the diskCollection<String>getKeys()StringgetName()Name of the cache, as specified upon cache creationvoidinvalidate(String key)Delete cache value for particular keyvoidinvalidateAll()Invalidates (removes) all cache elementsbooleanisAlive()Tread(String key)Read cache valuevoidsetAllowToReset(boolean allow)Specify whether it is allowed to reset this cache from UI from the Diagnostic->Caches page.voidwrite(String key, T value)Put a value to cache with default time to live and time to idlevoidwrite(String key, T value, int ttlSecs)Put a value to cache with timeout (time to live)
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:SCacheName of the cache, as specified upon cache creation
-
getKeys
@NotNull public Collection<String> getKeys()
-
setAllowToReset
public void setAllowToReset(boolean allow)
Description copied from interface:SCacheSpecify whether it is allowed to reset this cache from UI from the Diagnostic->Caches page.- Specified by:
setAllowToResetin interfaceSCache<T>
-
write
public void write(@NotNull String key, @Nullable T value)Description copied from interface:SCachePut a value to cache with default time to live and time to idle
-
write
public void write(@NotNull String key, @Nullable T value, int ttlSecs)Description copied from interface:SCachePut a value to cache with timeout (time to live)
-
fetch
public T fetch(String key, Calculator<T> dataFetcher)
Description copied from interface:SCacheGet data from cache, if available. If not, obtain the data using dataFetcher and put them to the cache. The operation is blocking for a particular key. I.e. multiple fetch operations for a single key will wait until first of them will fill the cache.
-
invalidate
public void invalidate(@NotNull String key)Description copied from interface:SCacheDelete cache value for particular key- Specified by:
invalidatein interfaceSCache<T>
-
flush
public void flush()
Description copied from interface:SCacheFlush all the cache data to the disk
-
destroy
public void destroy()
Description copied from interface:SCacheSame asSCache.invalidateAll().
-
invalidateAll
public void invalidateAll()
Description copied from interface:SCacheInvalidates (removes) all cache elements- Specified by:
invalidateAllin interfaceSCache<T>
-
isAlive
public boolean isAlive()
-
-