add support for cache writethrough
git-svn-id: svn://10.0.0.236/trunk@7210 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -30,6 +30,7 @@ public class IniFileData
|
||||
File me = null;
|
||||
boolean dirty = false;
|
||||
boolean writable = true;
|
||||
boolean alwaysDirty = false;
|
||||
|
||||
public static final String SECTION_PREFIX = "[";
|
||||
public static final String SECTION_POSTFIX = "]";
|
||||
@@ -122,6 +123,11 @@ public class IniFileData
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
public void setCacheState( boolean writeThrough )
|
||||
{
|
||||
alwaysDirty = writeThrough;
|
||||
}
|
||||
|
||||
public void flush() throws Exception
|
||||
{
|
||||
Trace.TRACE( "flushing " + me.getName() );
|
||||
@@ -170,11 +176,22 @@ public class IniFileData
|
||||
//Trace.TRACE( " setting value..." );
|
||||
nvSet.setValue( name, value );
|
||||
dirty = true;
|
||||
if ( alwaysDirty )
|
||||
try
|
||||
{
|
||||
flush();
|
||||
}
|
||||
catch ( Throwable e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDirty()
|
||||
{
|
||||
if ( alwaysDirty )
|
||||
return true;
|
||||
return dirty;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user