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 void
destroy()
Same asSCache.invalidateAll()
.abstract void
dispose()
Flushes data on disk (if cache is persistable) and frees all of the resources associated with this cache.T
fetch(String key, Calculator<T> dataFetcher)
Get data from cache, if available.void
flush()
Flush all the cache data to the diskCollection<String>
getKeys()
String
getName()
Name of the cache, as specified upon cache creationvoid
invalidate(String key)
Delete cache value for particular keyvoid
invalidateAll()
Invalidates (removes) all cache elementsboolean
isAlive()
T
read(String key)
Read cache valuevoid
setAllowToReset(boolean allow)
Specify whether it is allowed to reset this cache from UI from the Diagnostic->Caches page.void
write(String key, T value)
Put a value to cache with default time to live and time to idlevoid
write(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:SCache
Name of the cache, as specified upon cache creation
-
getKeys
@NotNull public Collection<String> getKeys()
-
setAllowToReset
public void setAllowToReset(boolean allow)
Description copied from interface:SCache
Specify whether it is allowed to reset this cache from UI from the Diagnostic->Caches page.- Specified by:
setAllowToReset
in interfaceSCache<T>
-
write
public void write(@NotNull String key, @Nullable T value)
Description copied from interface:SCache
Put 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:SCache
Put a value to cache with timeout (time to live)
-
fetch
public T fetch(String key, Calculator<T> dataFetcher)
Description copied from interface:SCache
Get 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:SCache
Delete cache value for particular key- Specified by:
invalidate
in interfaceSCache<T>
-
flush
public void flush()
Description copied from interface:SCache
Flush all the cache data to the disk
-
destroy
public void destroy()
Description copied from interface:SCache
Same asSCache.invalidateAll()
.
-
invalidateAll
public void invalidateAll()
Description copied from interface:SCache
Invalidates (removes) all cache elements- Specified by:
invalidateAll
in interfaceSCache<T>
-
isAlive
public boolean isAlive()
-
-