refactor: breakout flotasm cache last file access time to separate UpdateFileLastAccessTime() method for imminent reuse.

mb-throttle-test
Justin Clark-Casey (justincc) 2014-12-04 01:51:01 +00:00
parent c36bfdc60f
commit ad91143880
1 changed files with 19 additions and 7 deletions

View File

@ -256,13 +256,7 @@ namespace OpenSim.Region.CoreModules.Asset
// If the file is already cached, don't cache it, just touch it so access time is updated // If the file is already cached, don't cache it, just touch it so access time is updated
if (File.Exists(filename)) if (File.Exists(filename))
{ {
try UpdateFileLastAccessTime(filename);
{
File.SetLastAccessTime(filename, DateTime.Now);
}
catch
{
}
} }
else else
{ {
@ -321,6 +315,24 @@ namespace OpenSim.Region.CoreModules.Asset
} }
} }
/// <summary>
/// Updates the cached file with the current time.
/// </summary>
/// <param name="filename">Filename.</param>
/// <returns><c>true</c>, if the update was successful, false otherwise.</returns>
private bool UpdateFileLastAccessTime(string filename)
{
try
{
File.SetLastAccessTime(filename, DateTime.Now);
return true;
}
catch
{
return false;
}
}
/// <summary> /// <summary>
/// Try to get an asset from the in-memory cache. /// Try to get an asset from the in-memory cache.
/// </summary> /// </summary>