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:
timm%netscape.com
1998-08-04 01:06:09 +00:00
parent 79de90379f
commit d472fba684
2 changed files with 40 additions and 1 deletions

View File

@@ -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;
}