aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Cache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Cache.cs')
-rw-r--r--OpenSim/Framework/Cache.cs48
1 files changed, 24 insertions, 24 deletions
diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs
index 427072d..261e0f9 100644
--- a/OpenSim/Framework/Cache.cs
+++ b/OpenSim/Framework/Cache.cs
@@ -1,13 +1,13 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using libsecondlife; 3using OpenMetaverse;
4 4
5namespace Opensim.Framework 5namespace Opensim.Framework
6{ 6{
7 // The delegate we will use for performing fetch from backing store 7 // The delegate we will use for performing fetch from backing store
8 // 8 //
9 public delegate Object FetchDelegate(LLUUID index); 9 public delegate Object FetchDelegate(UUID index);
10 public delegate bool ExpireDelegate(LLUUID index); 10 public delegate bool ExpireDelegate(UUID index);
11 11
12 // Strategy 12 // Strategy
13 // 13 //
@@ -37,14 +37,14 @@ namespace Opensim.Framework
37 } 37 }
38 38
39 // The base class of all cache objects. Implements comparison and sorting 39 // The base class of all cache objects. Implements comparison and sorting
40 // by the LLUUID member. 40 // by the UUID member.
41 // 41 //
42 // This is not abstract because we need to instantiate it briefly as a 42 // This is not abstract because we need to instantiate it briefly as a
43 // method parameter 43 // method parameter
44 // 44 //
45 public class CacheItemBase : IEquatable<CacheItemBase>, IComparable<CacheItemBase> 45 public class CacheItemBase : IEquatable<CacheItemBase>, IComparable<CacheItemBase>
46 { 46 {
47 public LLUUID uuid; 47 public UUID uuid;
48 public DateTime entered; 48 public DateTime entered;
49 public DateTime lastUsed; 49 public DateTime lastUsed;
50 public DateTime expires = new DateTime(0); 50 public DateTime expires = new DateTime(0);
@@ -59,14 +59,14 @@ namespace Opensim.Framework
59 { 59 {
60 } 60 }
61 61
62 public CacheItemBase(LLUUID index) 62 public CacheItemBase(UUID index)
63 { 63 {
64 uuid = index; 64 uuid = index;
65 entered = DateTime.Now; 65 entered = DateTime.Now;
66 lastUsed = entered; 66 lastUsed = entered;
67 } 67 }
68 68
69 public CacheItemBase(LLUUID index, DateTime ttl) 69 public CacheItemBase(UUID index, DateTime ttl)
70 { 70 {
71 uuid = index; 71 uuid = index;
72 entered = DateTime.Now; 72 entered = DateTime.Now;
@@ -96,23 +96,23 @@ namespace Opensim.Framework
96 { 96 {
97 private Object m_Data; 97 private Object m_Data;
98 98
99 public MemoryCacheItem(LLUUID index) : 99 public MemoryCacheItem(UUID index) :
100 base(index) 100 base(index)
101 { 101 {
102 } 102 }
103 103
104 public MemoryCacheItem(LLUUID index, DateTime ttl) : 104 public MemoryCacheItem(UUID index, DateTime ttl) :
105 base(index, ttl) 105 base(index, ttl)
106 { 106 {
107 } 107 }
108 108
109 public MemoryCacheItem(LLUUID index, Object data) : 109 public MemoryCacheItem(UUID index, Object data) :
110 base(index) 110 base(index)
111 { 111 {
112 Store(data); 112 Store(data);
113 } 113 }
114 114
115 public MemoryCacheItem(LLUUID index, DateTime ttl, Object data) : 115 public MemoryCacheItem(UUID index, DateTime ttl, Object data) :
116 base(index, ttl) 116 base(index, ttl)
117 { 117 {
118 Store(data); 118 Store(data);
@@ -133,23 +133,23 @@ namespace Opensim.Framework
133 // 133 //
134 public class FileCacheItem : CacheItemBase 134 public class FileCacheItem : CacheItemBase
135 { 135 {
136 public FileCacheItem(LLUUID index) : 136 public FileCacheItem(UUID index) :
137 base(index) 137 base(index)
138 { 138 {
139 } 139 }
140 140
141 public FileCacheItem(LLUUID index, DateTime ttl) : 141 public FileCacheItem(UUID index, DateTime ttl) :
142 base(index, ttl) 142 base(index, ttl)
143 { 143 {
144 } 144 }
145 145
146 public FileCacheItem(LLUUID index, Object data) : 146 public FileCacheItem(UUID index, Object data) :
147 base(index) 147 base(index)
148 { 148 {
149 Store(data); 149 Store(data);
150 } 150 }
151 151
152 public FileCacheItem(LLUUID index, DateTime ttl, Object data) : 152 public FileCacheItem(UUID index, DateTime ttl, Object data) :
153 base(index, ttl) 153 base(index, ttl)
154 { 154 {
155 Store(data); 155 Store(data);
@@ -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<UUID, CacheItemBase> m_Lookup =
177 new Dictionary<LLUUID, CacheItemBase>(); 177 new Dictionary<UUID, CacheItemBase>();
178 178
179 private CacheStrategy m_Strategy; 179 private CacheStrategy m_Strategy;
180 private CacheMedium m_Medium; 180 private CacheMedium m_Medium;
@@ -285,7 +285,7 @@ namespace Opensim.Framework
285 285
286 // Get an item from cache. Return the raw item, not it's data 286 // Get an item from cache. Return the raw item, not it's data
287 // 287 //
288 protected virtual CacheItemBase GetItem(LLUUID index) 288 protected virtual CacheItemBase GetItem(UUID index)
289 { 289 {
290 CacheItemBase item = null; 290 CacheItemBase item = null;
291 291
@@ -312,7 +312,7 @@ namespace Opensim.Framework
312 // Get an item from cache. Do not try to fetch from source if not 312 // Get an item from cache. Do not try to fetch from source if not
313 // present. Just return null 313 // present. Just return null
314 // 314 //
315 public virtual Object Get(LLUUID index) 315 public virtual Object Get(UUID index)
316 { 316 {
317 CacheItemBase item = GetItem(index); 317 CacheItemBase item = GetItem(index);
318 318
@@ -325,7 +325,7 @@ namespace Opensim.Framework
325 // Fetch an object from backing store if not cached, serve from 325 // Fetch an object from backing store if not cached, serve from
326 // cache if it is. 326 // cache if it is.
327 // 327 //
328 public virtual Object Get(LLUUID index, FetchDelegate fetch) 328 public virtual Object Get(UUID index, FetchDelegate fetch)
329 { 329 {
330 Object item = Get(index); 330 Object item = Get(index);
331 if (item != null) 331 if (item != null)
@@ -366,7 +366,7 @@ namespace Opensim.Framework
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(UUID index, Object data)
370 { 370 {
371 Type container; 371 Type container;
372 372
@@ -384,12 +384,12 @@ namespace Opensim.Framework
384 Store(index, data, container); 384 Store(index, data, container);
385 } 385 }
386 386
387 public virtual void Store(LLUUID index, Object data, Type container) 387 public virtual void Store(UUID index, Object data, Type container)
388 { 388 {
389 Store(index, data, container, new Object[] { index }); 389 Store(index, data, container, new Object[] { index });
390 } 390 }
391 391
392 public virtual void Store(LLUUID index, Object data, Type container, 392 public virtual void Store(UUID index, Object data, Type container,
393 Object[] parameters) 393 Object[] parameters)
394 { 394 {
395 Expire(false); 395 Expire(false);
@@ -493,7 +493,7 @@ namespace Opensim.Framework
493 } 493 }
494 } 494 }
495 495
496 public void Invalidate(LLUUID uuid) 496 public void Invalidate(UUID uuid)
497 { 497 {
498 if (!m_Lookup.ContainsKey(uuid)) 498 if (!m_Lookup.ContainsKey(uuid))
499 return; 499 return;