@ThreadSafe public class DefaultCacheAccess extends Object implements CacheAccess
| Constructor and Description |
|---|
DefaultCacheAccess(String cacheDisplayName,
File lockFile,
FileLockManager lockManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
FileLock |
getFileLock() |
<T> T |
longRunningOperation(String operationDisplayName,
Factory<? extends T> action)
Performs some long running operation within an action invoked by
CacheAccess.useCache(String, org.gradle.internal.Factory). |
void |
longRunningOperation(String operationDisplayName,
Runnable action)
Performs some long running operation within an action invoked by
CacheAccess.useCache(String, org.gradle.internal.Factory). |
<K,V> PersistentIndexedCache<K,V> |
newCache(File cacheFile,
Class<K> keyType,
Class<V> valueType) |
<K,V> PersistentIndexedCache<K,V> |
newCache(File cacheFile,
Class<K> keyType,
Serializer<V> valueSerializer) |
void |
open(FileLockManager.LockMode lockMode)
Opens this cache access with the given lock mode.
|
<T> T |
useCache(String operationDisplayName,
Factory<? extends T> action)
Performs some work against the cache.
|
void |
useCache(String operationDisplayName,
Runnable action)
Performs some work against the cache.
|
public DefaultCacheAccess(String cacheDisplayName, File lockFile, FileLockManager lockManager)
public void open(FileLockManager.LockMode lockMode)
FileLockManager.LockMode.Exclusive will
lock the cache for exclusive access from all other threads (including those in this process and all other processes), until
close() is called.public void close()
public FileLock getFileLock()
public void useCache(String operationDisplayName, Runnable action)
CacheAccessThis method is re-entrant, so that an action can call back into this method.
useCache in interface CacheAccesspublic <T> T useCache(String operationDisplayName, Factory<? extends T> action)
CacheAccessThis method is re-entrant, so that an action can call back into this method.
useCache in interface CacheAccesspublic <T> T longRunningOperation(String operationDisplayName, Factory<? extends T> action)
CacheAccessCacheAccess.useCache(String, org.gradle.internal.Factory). Releases all
locks while the operation is running, and reacquires the locks at the end of the long running operation.
This method is re-entrant, so that an action can call back into this method.
longRunningOperation in interface CacheAccesspublic void longRunningOperation(String operationDisplayName, Runnable action)
CacheAccessCacheAccess.useCache(String, org.gradle.internal.Factory). Releases all
locks while the operation is running, and reacquires the locks at the end of the long running operation.
This method is re-entrant, so that an action can call back into this method.
longRunningOperation in interface CacheAccesspublic <K,V> PersistentIndexedCache<K,V> newCache(File cacheFile, Class<K> keyType, Class<V> valueType)
public <K,V> PersistentIndexedCache<K,V> newCache(File cacheFile, Class<K> keyType, Serializer<V> valueSerializer)
Copyright © 2013. All rights reserved