diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Cache.cs | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs index 8d93d3e..4746d3c 100644 --- a/OpenSim/Framework/Cache.cs +++ b/OpenSim/Framework/Cache.cs | |||
@@ -173,8 +173,8 @@ namespace Opensim.Framework | |||
173 | public class Cache | 173 | public class Cache |
174 | { | 174 | { |
175 | private List<CacheItemBase> m_Index = new List<CacheItemBase>(); | 175 | private List<CacheItemBase> m_Index = new List<CacheItemBase>(); |
176 | private Dictionary<LLUUID, CacheItemBase> m_Lookup = | 176 | private Dictionary<LLUUID, CacheItemBase> m_Lookup = |
177 | new Dictionary<LLUUID, CacheItemBase>(); | 177 | new Dictionary<LLUUID, CacheItemBase>(); |
178 | 178 | ||
179 | private CacheStrategy m_Strategy; | 179 | private CacheStrategy m_Strategy; |
180 | private CacheMedium m_Medium; | 180 | private CacheMedium m_Medium; |
@@ -270,10 +270,10 @@ namespace Opensim.Framework | |||
270 | m_Index.RemoveRange(newSize, Count - newSize); | 270 | m_Index.RemoveRange(newSize, Count - newSize); |
271 | m_Size = newSize; | 271 | m_Size = newSize; |
272 | 272 | ||
273 | m_Lookup.Clear(); | 273 | m_Lookup.Clear(); |
274 | 274 | ||
275 | foreach (CacheItemBase item in m_Index) | 275 | foreach (CacheItemBase item in m_Index) |
276 | m_Lookup[item.uuid] = item; | 276 | m_Lookup[item.uuid] = item; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
@@ -291,8 +291,8 @@ namespace Opensim.Framework | |||
291 | 291 | ||
292 | lock (m_Index) | 292 | lock (m_Index) |
293 | { | 293 | { |
294 | if(m_Lookup.ContainsKey(index)) | 294 | if (m_Lookup.ContainsKey(index)) |
295 | item = m_Lookup[index]; | 295 | item = m_Lookup[index]; |
296 | } | 296 | } |
297 | 297 | ||
298 | if (item == null) | 298 | if (item == null) |
@@ -340,10 +340,10 @@ namespace Opensim.Framework | |||
340 | { | 340 | { |
341 | CacheItemBase missing = new CacheItemBase(index); | 341 | CacheItemBase missing = new CacheItemBase(index); |
342 | if (!m_Index.Contains(missing)) | 342 | if (!m_Index.Contains(missing)) |
343 | { | 343 | { |
344 | m_Index.Add(missing); | 344 | m_Index.Add(missing); |
345 | m_Lookup[index] = missing; | 345 | m_Lookup[index] = missing; |
346 | } | 346 | } |
347 | } | 347 | } |
348 | } | 348 | } |
349 | return null; | 349 | return null; |
@@ -354,17 +354,17 @@ namespace Opensim.Framework | |||
354 | return data; | 354 | return data; |
355 | } | 355 | } |
356 | 356 | ||
357 | // Find an object in cache by delegate. | 357 | // Find an object in cache by delegate. |
358 | // | 358 | // |
359 | public Object Find(Predicate<Opensim.Framework.CacheItemBase> d) | 359 | public Object Find(Predicate<Opensim.Framework.CacheItemBase> d) |
360 | { | 360 | { |
361 | CacheItemBase item = m_Index.Find(d); | 361 | CacheItemBase item = m_Index.Find(d); |
362 | 362 | ||
363 | if(item == null) | 363 | if (item == null) |
364 | return null; | 364 | return null; |
365 | 365 | ||
366 | return item.Retrieve(); | 366 | return item.Retrieve(); |
367 | } | 367 | } |
368 | 368 | ||
369 | public virtual void Store(LLUUID index, Object data) | 369 | public virtual void Store(LLUUID index, Object data) |
370 | { | 370 | { |
@@ -421,7 +421,7 @@ namespace Opensim.Framework | |||
421 | item.expires = DateTime.Now + m_DefaultTTL; | 421 | item.expires = DateTime.Now + m_DefaultTTL; |
422 | 422 | ||
423 | m_Index.Add(item); | 423 | m_Index.Add(item); |
424 | m_Lookup[index] = item; | 424 | m_Lookup[index] = item; |
425 | } | 425 | } |
426 | item.Store(data); | 426 | item.Store(data); |
427 | } | 427 | } |
@@ -439,10 +439,10 @@ namespace Opensim.Framework | |||
439 | { | 439 | { |
440 | if (item.expires.Ticks == 0 || | 440 | if (item.expires.Ticks == 0 || |
441 | item.expires <= now) | 441 | item.expires <= now) |
442 | { | 442 | { |
443 | m_Index.Remove(item); | 443 | m_Index.Remove(item); |
444 | m_Lookup.Remove(item.uuid); | 444 | m_Lookup.Remove(item.uuid); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
@@ -471,20 +471,20 @@ namespace Opensim.Framework | |||
471 | foreach (CacheItemBase i in candidates) | 471 | foreach (CacheItemBase i in candidates) |
472 | { | 472 | { |
473 | if (doExpire(i.uuid)) | 473 | if (doExpire(i.uuid)) |
474 | { | 474 | { |
475 | m_Index.Remove(i); | 475 | m_Index.Remove(i); |
476 | m_Lookup.Remove(i.uuid); | 476 | m_Lookup.Remove(i.uuid); |
477 | } | 477 | } |
478 | } | 478 | } |
479 | } | 479 | } |
480 | else | 480 | else |
481 | { | 481 | { |
482 | m_Index.RemoveRange(target, Count - target); | 482 | m_Index.RemoveRange(target, Count - target); |
483 | 483 | ||
484 | m_Lookup.Clear(); | 484 | m_Lookup.Clear(); |
485 | 485 | ||
486 | foreach (CacheItemBase item in m_Index) | 486 | foreach (CacheItemBase item in m_Index) |
487 | m_Lookup[item.uuid] = item; | 487 | m_Lookup[item.uuid] = item; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | break; | 490 | break; |