@NotThreadSafe @CleanupObligation public final class IOCache extends Object implements Flushable, Closeable
cleared
.
IOCache.Strategy
, entry data written to the
cache may not be written to the backing store until the cache gets
flushed
.
cleared
.
Note that you need to call `configure` before you can do any input or output.
Modifier and Type | Class and Description |
---|---|
static class |
IOCache.Strategy
Provides different cache strategies.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the entry data from this cache without flushing it.
|
void |
close()
|
IOCache |
configure(InputSocket<?> input)
Configures the input socket for reading the entry data from the
backing store.
|
IOCache |
configure(OutputSocket<?> output)
Configures the output socket for writing the entry data to the
backing store.
|
void |
flush()
Writes the cached entry data to the backing store unless already done.
|
Entry |
getEntry() |
InputSocket<?> |
getInputSocket()
Returns an input socket for reading the cached entry data.
|
OutputSocket<?> |
getOutputSocket()
Returns an output socket for writing the cached entry data.
|
public void clear() throws IOException
IOException
- on any I/O failure.@DischargesObligation public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public IOCache configure(InputSocket<?> input)
NullPointerException
will be thrown on the first
read attempt.
Note that calling this method does not clear
this cache.input
- an input socket for reading the entry data from the
backing store.this
public IOCache configure(OutputSocket<?> output)
NullPointerException
will be thrown on the first
write attempt.
Note that calling this method does not flush
this cache.output
- an output socket for writing the entry data to the
backing store.this
public void flush() throws IOException
IOCache.Strategy.WRITE_THROUGH
writes any
changed entry data immediately, so calling this method has no effect.flush
in interface Flushable
IOException
public InputSocket<?> getInputSocket()
public OutputSocket<?> getOutputSocket()
Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.