public static class CachingObjectStorage.Handler extends Object implements InvocationHandler
ObjectStorage
instance.
This will continue to work, even as new methods are added to the interface.Constructor and Description |
---|
Handler(com.oracle.bmc.objectstorage.ObjectStorage client,
com.oracle.bmc.objectstorage.transfer.DownloadConfiguration downloadConfiguration,
Path cacheDirectory,
ExecutorService downloadExecutor,
CachingObjectStorage.UncacheablePredicate uncacheablePredicate,
ConsistencyPolicy consistencyPolicy,
CacheBuilder<CachingObjectStorage.GetObjectRequestCacheKey,CachingObjectStorage.GetObjectResponseCacheValue,?> cacheBuilder,
ExecutorService deletionExecutor,
CachingObjectStorage.RowLockProvider rowLockProvider,
Runnable cacheGarbageCollection)
Create an
ObjectStorage client that caches the contents returned by
ObjectStorage.getObject(GetObjectRequest) on disk. |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanUp()
Performs cache clean-up, i.e.
|
protected void |
close() |
protected Cache.Statistics |
getCacheStatistics()
Return the statistics for the getObject cache.
|
protected Set<Path> |
getEvictedButNotDeleted()
Returns a read-only set of paths to files that have been evicted but not deleted yet, since they are still
being read.
|
protected com.oracle.bmc.objectstorage.responses.GetObjectResponse |
getObject(com.oracle.bmc.objectstorage.requests.GetObjectRequest getObjectRequest) |
protected com.oracle.bmc.objectstorage.responses.GetObjectResponse |
getObjectUncached(com.oracle.bmc.objectstorage.requests.GetObjectRequest getObjectRequest)
Get the object, circumventing the cache.
|
protected Set<? extends PhantomReference> |
getPhantomReferences()
For debug purposes, returns a read-only set of phantom references for the cached items.
|
Object |
invoke(Object proxy,
Method method,
Object[] args) |
protected void |
prepopulateCache(com.oracle.bmc.objectstorage.requests.GetObjectRequest cacheRequest,
com.oracle.bmc.objectstorage.responses.GetObjectResponse cacheResponse)
Populates the cache at the request with the given response.
|
public Handler(com.oracle.bmc.objectstorage.ObjectStorage client, com.oracle.bmc.objectstorage.transfer.DownloadConfiguration downloadConfiguration, Path cacheDirectory, ExecutorService downloadExecutor, CachingObjectStorage.UncacheablePredicate uncacheablePredicate, ConsistencyPolicy consistencyPolicy, CacheBuilder<CachingObjectStorage.GetObjectRequestCacheKey,CachingObjectStorage.GetObjectResponseCacheValue,?> cacheBuilder, ExecutorService deletionExecutor, CachingObjectStorage.RowLockProvider rowLockProvider, Runnable cacheGarbageCollection)
ObjectStorage
client that caches the contents returned by
ObjectStorage.getObject(GetObjectRequest)
on disk.client
- ObjectStorage
clientdownloadConfiguration
- DownloadConfiguration
to use for downloadingcacheDirectory
- directory where the cache is storeddownloadExecutor
- executor for providing the threads in which objects will be downloaded to the cacheuncacheablePredicate
- predicate that decides if a request cannot be cachedconsistencyPolicy
- controls eviction of conflicting itemscacheBuilder
- cache builder to control size and evictiondeletionExecutor
- for creating a thread that deletes evicted files after they are not being read anymorerowLockProvider
- provider for row lockscacheGarbageCollection
- runnable to be executed when there is a cache updatepublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
protected com.oracle.bmc.objectstorage.responses.GetObjectResponse getObject(com.oracle.bmc.objectstorage.requests.GetObjectRequest getObjectRequest)
protected void prepopulateCache(com.oracle.bmc.objectstorage.requests.GetObjectRequest cacheRequest, com.oracle.bmc.objectstorage.responses.GetObjectResponse cacheResponse)
cacheRequest
- request entry to fill.cacheResponse
- content to be put at the cache entry.protected com.oracle.bmc.objectstorage.responses.GetObjectResponse getObjectUncached(com.oracle.bmc.objectstorage.requests.GetObjectRequest getObjectRequest)
getObjectRequest
- requestprotected void cleanUp()
ObjectStorage.getObject(GetObjectRequest)
operations are performed, but in absence of such
activity, this method can be used to trigger clean-up on-demand.protected Set<Path> getEvictedButNotDeleted()
protected Set<? extends PhantomReference> getPhantomReferences()
protected Cache.Statistics getCacheStatistics()
Copyright © 2016–2023. All rights reserved.