diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Cache.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs index 3dab9b6..2d49146 100644 --- a/OpenSim/Framework/Cache.cs +++ b/OpenSim/Framework/Cache.cs | |||
@@ -33,8 +33,8 @@ namespace OpenSim.Framework | |||
33 | { | 33 | { |
34 | // The delegate we will use for performing fetch from backing store | 34 | // The delegate we will use for performing fetch from backing store |
35 | // | 35 | // |
36 | public delegate Object FetchDelegate(UUID index); | 36 | public delegate Object FetchDelegate(string index); |
37 | public delegate bool ExpireDelegate(UUID index); | 37 | public delegate bool ExpireDelegate(string index); |
38 | 38 | ||
39 | // Strategy | 39 | // Strategy |
40 | // | 40 | // |
@@ -64,14 +64,14 @@ namespace OpenSim.Framework | |||
64 | } | 64 | } |
65 | 65 | ||
66 | // The base class of all cache objects. Implements comparison and sorting | 66 | // The base class of all cache objects. Implements comparison and sorting |
67 | // by the UUID member. | 67 | // by the string member. |
68 | // | 68 | // |
69 | // This is not abstract because we need to instantiate it briefly as a | 69 | // This is not abstract because we need to instantiate it briefly as a |
70 | // method parameter | 70 | // method parameter |
71 | // | 71 | // |
72 | public class CacheItemBase : IEquatable<CacheItemBase>, IComparable<CacheItemBase> | 72 | public class CacheItemBase : IEquatable<CacheItemBase>, IComparable<CacheItemBase> |
73 | { | 73 | { |
74 | public UUID uuid; | 74 | public string uuid; |
75 | public DateTime entered; | 75 | public DateTime entered; |
76 | public DateTime lastUsed; | 76 | public DateTime lastUsed; |
77 | public DateTime expires = new DateTime(0); | 77 | public DateTime expires = new DateTime(0); |
@@ -86,14 +86,14 @@ namespace OpenSim.Framework | |||
86 | { | 86 | { |
87 | } | 87 | } |
88 | 88 | ||
89 | public CacheItemBase(UUID index) | 89 | public CacheItemBase(string index) |
90 | { | 90 | { |
91 | uuid = index; | 91 | uuid = index; |
92 | entered = DateTime.Now; | 92 | entered = DateTime.Now; |
93 | lastUsed = entered; | 93 | lastUsed = entered; |
94 | } | 94 | } |
95 | 95 | ||
96 | public CacheItemBase(UUID index, DateTime ttl) | 96 | public CacheItemBase(string index, DateTime ttl) |
97 | { | 97 | { |
98 | uuid = index; | 98 | uuid = index; |
99 | entered = DateTime.Now; | 99 | entered = DateTime.Now; |
@@ -123,23 +123,23 @@ namespace OpenSim.Framework | |||
123 | { | 123 | { |
124 | private Object m_Data; | 124 | private Object m_Data; |
125 | 125 | ||
126 | public MemoryCacheItem(UUID index) : | 126 | public MemoryCacheItem(string index) : |
127 | base(index) | 127 | base(index) |
128 | { | 128 | { |
129 | } | 129 | } |
130 | 130 | ||
131 | public MemoryCacheItem(UUID index, DateTime ttl) : | 131 | public MemoryCacheItem(string index, DateTime ttl) : |
132 | base(index, ttl) | 132 | base(index, ttl) |
133 | { | 133 | { |
134 | } | 134 | } |
135 | 135 | ||
136 | public MemoryCacheItem(UUID index, Object data) : | 136 | public MemoryCacheItem(string index, Object data) : |
137 | base(index) | 137 | base(index) |
138 | { | 138 | { |
139 | Store(data); | 139 | Store(data); |
140 | } | 140 | } |
141 | 141 | ||
142 | public MemoryCacheItem(UUID index, DateTime ttl, Object data) : | 142 | public MemoryCacheItem(string index, DateTime ttl, Object data) : |
143 | base(index, ttl) | 143 | base(index, ttl) |
144 | { | 144 | { |
145 | Store(data); | 145 | Store(data); |
@@ -160,23 +160,23 @@ namespace OpenSim.Framework | |||
160 | // | 160 | // |
161 | public class FileCacheItem : CacheItemBase | 161 | public class FileCacheItem : CacheItemBase |
162 | { | 162 | { |
163 | public FileCacheItem(UUID index) : | 163 | public FileCacheItem(string index) : |
164 | base(index) | 164 | base(index) |
165 | { | 165 | { |
166 | } | 166 | } |
167 | 167 | ||
168 | public FileCacheItem(UUID index, DateTime ttl) : | 168 | public FileCacheItem(string index, DateTime ttl) : |
169 | base(index, ttl) | 169 | base(index, ttl) |
170 | { | 170 | { |
171 | } | 171 | } |
172 | 172 | ||
173 | public FileCacheItem(UUID index, Object data) : | 173 | public FileCacheItem(string index, Object data) : |
174 | base(index) | 174 | base(index) |
175 | { | 175 | { |
176 | Store(data); | 176 | Store(data); |
177 | } | 177 | } |
178 | 178 | ||
179 | public FileCacheItem(UUID index, DateTime ttl, Object data) : | 179 | public FileCacheItem(string index, DateTime ttl, Object data) : |
180 | base(index, ttl) | 180 | base(index, ttl) |
181 | { | 181 | { |
182 | Store(data); | 182 | Store(data); |
@@ -200,8 +200,8 @@ namespace OpenSim.Framework | |||
200 | public class Cache | 200 | public class Cache |
201 | { | 201 | { |
202 | private List<CacheItemBase> m_Index = new List<CacheItemBase>(); | 202 | private List<CacheItemBase> m_Index = new List<CacheItemBase>(); |
203 | private Dictionary<UUID, CacheItemBase> m_Lookup = | 203 | private Dictionary<string, CacheItemBase> m_Lookup = |
204 | new Dictionary<UUID, CacheItemBase>(); | 204 | new Dictionary<string, CacheItemBase>(); |
205 | 205 | ||
206 | private CacheStrategy m_Strategy; | 206 | private CacheStrategy m_Strategy; |
207 | private CacheMedium m_Medium; | 207 | private CacheMedium m_Medium; |
@@ -312,7 +312,7 @@ namespace OpenSim.Framework | |||
312 | 312 | ||
313 | // Get an item from cache. Return the raw item, not it's data | 313 | // Get an item from cache. Return the raw item, not it's data |
314 | // | 314 | // |
315 | protected virtual CacheItemBase GetItem(UUID index) | 315 | protected virtual CacheItemBase GetItem(string index) |
316 | { | 316 | { |
317 | CacheItemBase item = null; | 317 | CacheItemBase item = null; |
318 | 318 | ||
@@ -339,7 +339,7 @@ namespace OpenSim.Framework | |||
339 | // Get an item from cache. Do not try to fetch from source if not | 339 | // Get an item from cache. Do not try to fetch from source if not |
340 | // present. Just return null | 340 | // present. Just return null |
341 | // | 341 | // |
342 | public virtual Object Get(UUID index) | 342 | public virtual Object Get(string index) |
343 | { | 343 | { |
344 | CacheItemBase item = GetItem(index); | 344 | CacheItemBase item = GetItem(index); |
345 | 345 | ||
@@ -352,7 +352,7 @@ namespace OpenSim.Framework | |||
352 | // Fetch an object from backing store if not cached, serve from | 352 | // Fetch an object from backing store if not cached, serve from |
353 | // cache if it is. | 353 | // cache if it is. |
354 | // | 354 | // |
355 | public virtual Object Get(UUID index, FetchDelegate fetch) | 355 | public virtual Object Get(string index, FetchDelegate fetch) |
356 | { | 356 | { |
357 | Object item = Get(index); | 357 | Object item = Get(index); |
358 | if (item != null) | 358 | if (item != null) |
@@ -393,7 +393,7 @@ namespace OpenSim.Framework | |||
393 | return item.Retrieve(); | 393 | return item.Retrieve(); |
394 | } | 394 | } |
395 | 395 | ||
396 | public virtual void Store(UUID index, Object data) | 396 | public virtual void Store(string index, Object data) |
397 | { | 397 | { |
398 | Type container; | 398 | Type container; |
399 | 399 | ||
@@ -411,12 +411,12 @@ namespace OpenSim.Framework | |||
411 | Store(index, data, container); | 411 | Store(index, data, container); |
412 | } | 412 | } |
413 | 413 | ||
414 | public virtual void Store(UUID index, Object data, Type container) | 414 | public virtual void Store(string index, Object data, Type container) |
415 | { | 415 | { |
416 | Store(index, data, container, new Object[] { index }); | 416 | Store(index, data, container, new Object[] { index }); |
417 | } | 417 | } |
418 | 418 | ||
419 | public virtual void Store(UUID index, Object data, Type container, | 419 | public virtual void Store(string index, Object data, Type container, |
420 | Object[] parameters) | 420 | Object[] parameters) |
421 | { | 421 | { |
422 | Expire(false); | 422 | Expire(false); |
@@ -520,7 +520,7 @@ namespace OpenSim.Framework | |||
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
523 | public void Invalidate(UUID uuid) | 523 | public void Invalidate(string uuid) |
524 | { | 524 | { |
525 | if (!m_Lookup.ContainsKey(uuid)) | 525 | if (!m_Lookup.ContainsKey(uuid)) |
526 | return; | 526 | return; |