DataSink.Factory
public static final class CacheDataSink.Factory extends Object implements DataSink.Factory
DataSink.Factory
for CacheDataSink
instances.Constructor | Description |
---|---|
Factory() |
Creates an instance.
|
Modifier and Type | Method | Description |
---|---|---|
DataSink |
createDataSink() |
Creates a
DataSink instance. |
CacheDataSink.Factory |
setBufferSize(int bufferSize) |
Sets the size of an in-memory buffer used when writing to a cache file.
|
CacheDataSink.Factory |
setCache(Cache cache) |
Sets the cache to which data will be written.
|
CacheDataSink.Factory |
setFragmentSize(long fragmentSize) |
Sets the cache file fragment size.
|
public CacheDataSink.Factory setCache(Cache cache)
Must be called before the factory is used.
cache
- The cache to which data will be written.public CacheDataSink.Factory setFragmentSize(long fragmentSize)
C.LENGTH_UNSET
then no fragmentation will occur. Using a small value allows for finer-grained cache eviction
policies, at the cost of increased overhead both on the cache implementation and the file
system. Values under (2 * 1024 * 1024)
are not recommended.
The default value is CacheDataSink.DEFAULT_FRAGMENT_SIZE
.
fragmentSize
- The fragment size in bytes, or C.LENGTH_UNSET
to disable
fragmentation.public CacheDataSink.Factory setBufferSize(int bufferSize)
The default value is CacheDataSink.DEFAULT_BUFFER_SIZE
.
bufferSize
- The buffer size in bytes.public DataSink createDataSink()
DataSink.Factory
DataSink
instance.createDataSink
in interface DataSink.Factory