diff options
author | Justin Clark-Casey (justincc) | 2014-12-04 01:51:01 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-12-04 01:51:01 +0000 |
commit | ad91143880582bbb9dd956ddce7ab1dc9a4215b0 (patch) | |
tree | 5772811914d7fc7faa6d90be37768012bb4f9f64 /OpenSim/Region | |
parent | Don't worry about checking FlotsamAssetCache.m_CurrentlyWriting when updating... (diff) | |
download | opensim-SC_OLD-ad91143880582bbb9dd956ddce7ab1dc9a4215b0.zip opensim-SC_OLD-ad91143880582bbb9dd956ddce7ab1dc9a4215b0.tar.gz opensim-SC_OLD-ad91143880582bbb9dd956ddce7ab1dc9a4215b0.tar.bz2 opensim-SC_OLD-ad91143880582bbb9dd956ddce7ab1dc9a4215b0.tar.xz |
refactor: breakout flotasm cache last file access time to separate UpdateFileLastAccessTime() method for imminent reuse.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 26 |
1 files 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 | |||
256 | // If the file is already cached, don't cache it, just touch it so access time is updated | 256 | // If the file is already cached, don't cache it, just touch it so access time is updated |
257 | if (File.Exists(filename)) | 257 | if (File.Exists(filename)) |
258 | { | 258 | { |
259 | try | 259 | UpdateFileLastAccessTime(filename); |
260 | { | ||
261 | File.SetLastAccessTime(filename, DateTime.Now); | ||
262 | } | ||
263 | catch | ||
264 | { | ||
265 | } | ||
266 | } | 260 | } |
267 | else | 261 | else |
268 | { | 262 | { |
@@ -322,6 +316,24 @@ namespace OpenSim.Region.CoreModules.Asset | |||
322 | } | 316 | } |
323 | 317 | ||
324 | /// <summary> | 318 | /// <summary> |
319 | /// Updates the cached file with the current time. | ||
320 | /// </summary> | ||
321 | /// <param name="filename">Filename.</param> | ||
322 | /// <returns><c>true</c>, if the update was successful, false otherwise.</returns> | ||
323 | private bool UpdateFileLastAccessTime(string filename) | ||
324 | { | ||
325 | try | ||
326 | { | ||
327 | File.SetLastAccessTime(filename, DateTime.Now); | ||
328 | return true; | ||
329 | } | ||
330 | catch | ||
331 | { | ||
332 | return false; | ||
333 | } | ||
334 | } | ||
335 | |||
336 | /// <summary> | ||
325 | /// Try to get an asset from the in-memory cache. | 337 | /// Try to get an asset from the in-memory cache. |
326 | /// </summary> | 338 | /// </summary> |
327 | /// <param name="id"></param> | 339 | /// <param name="id"></param> |