@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.
| 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 Closeableclose in interface AutoCloseableIOExceptionpublic 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.thispublic 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.thispublic void flush()
throws IOException
IOCache.Strategy.WRITE_THROUGH writes any
changed entry data immediately, so calling this method has no effect.flush in interface FlushableIOExceptionpublic InputSocket<?> getInputSocket()
public OutputSocket<?> getOutputSocket()
Copyright © 2005-2013 Schlichtherle IT Services. All Rights Reserved.