From ad91143880582bbb9dd956ddce7ab1dc9a4215b0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Dec 2014 01:51:01 +0000 Subject: refactor: breakout flotasm cache last file access time to separate UpdateFileLastAccessTime() method for imminent reuse. --- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 26 ++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index bc5b39b..7780568 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -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 (File.Exists(filename)) { - try - { - File.SetLastAccessTime(filename, DateTime.Now); - } - catch - { - } + UpdateFileLastAccessTime(filename); } else { @@ -322,6 +316,24 @@ namespace OpenSim.Region.CoreModules.Asset } /// + /// Updates the cached file with the current time. + /// + /// Filename. + /// true, if the update was successful, false otherwise. + private bool UpdateFileLastAccessTime(string filename) + { + try + { + File.SetLastAccessTime(filename, DateTime.Now); + return true; + } + catch + { + return false; + } + } + + /// /// Try to get an asset from the in-memory cache. /// /// -- cgit v1.1