aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/AssetCache.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-04-14 16:36:32 +0000
committerJustin Clarke Casey2009-04-14 16:36:32 +0000
commitad2bd740574b7695a74bb65a63c4bb884cafdf7d (patch)
tree4193c42afcd93ba2c26d717cb3d38654b0544365 /OpenSim/Framework/Communications/Cache/AssetCache.cs
parent- adding Makefile.local to .gitignore (diff)
downloadopensim-SC_OLD-ad2bd740574b7695a74bb65a63c4bb884cafdf7d.zip
opensim-SC_OLD-ad2bd740574b7695a74bb65a63c4bb884cafdf7d.tar.gz
opensim-SC_OLD-ad2bd740574b7695a74bb65a63c4bb884cafdf7d.tar.bz2
opensim-SC_OLD-ad2bd740574b7695a74bb65a63c4bb884cafdf7d.tar.xz
* refactor: rename AssetCache.Initialize() to AssetCache.Reset() to avoid having Initialise() and Initialize() in the same class - very difficult to read.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetCache.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs83
1 files changed, 40 insertions, 43 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index f8b5757..8c451b0 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -49,6 +49,26 @@ namespace OpenSim.Framework.Communications.Cache
49 /// AssetNotFound(), which means they do share the same asset and texture caches. 49 /// AssetNotFound(), which means they do share the same asset and texture caches.
50 public class AssetCache : IAssetCache 50 public class AssetCache : IAssetCache
51 { 51 {
52 private static readonly ILog m_log
53 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 protected ICache m_memcache = new SimpleMemoryCache();
56
57 /// <value>
58 /// Assets requests which are waiting for asset server data. This includes texture requests
59 /// </value>
60 private Dictionary<UUID, AssetRequest> RequestedAssets;
61
62 /// <value>
63 /// Asset requests with data which are ready to be sent back to requesters. This includes textures.
64 /// </value>
65 private List<AssetRequest> AssetRequests;
66
67 /// <value>
68 /// Until the asset request is fulfilled, each asset request is associated with a list of requesters
69 /// </value>
70 private Dictionary<UUID, AssetRequestsList> RequestLists;
71
52 #region IPlugin 72 #region IPlugin
53 73
54 /// <summary> 74 /// <summary>
@@ -77,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache
77 m_log.Debug("[ASSET CACHE]: Asset cache server-specified initialisation"); 97 m_log.Debug("[ASSET CACHE]: Asset cache server-specified initialisation");
78 m_log.InfoFormat("[ASSET CACHE]: Asset cache initialisation [{0}/{1}]", Name, Version); 98 m_log.InfoFormat("[ASSET CACHE]: Asset cache initialisation [{0}/{1}]", Name, Version);
79 99
80 Initialize(); 100 Reset();
81 101
82 m_assetServer = assetServer; 102 m_assetServer = assetServer;
83 m_assetServer.SetReceiver(this); 103 m_assetServer.SetReceiver(this);
@@ -95,42 +115,31 @@ namespace OpenSim.Framework.Communications.Cache
95 Initialise(assetServer); 115 Initialise(assetServer);
96 } 116 }
97 117
98 public AssetCache()
99 {
100 m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)");
101 }
102
103 public void Dispose() 118 public void Dispose()
104 { 119 {
105 } 120 }
106 121
107 #endregion 122 #endregion
108
109 protected ICache m_memcache = new SimpleMemoryCache();
110
111 private static readonly ILog m_log
112 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
113
114 /// <value>
115 /// Assets requests which are waiting for asset server data. This includes texture requests
116 /// </value>
117 private Dictionary<UUID, AssetRequest> RequestedAssets;
118
119 /// <value>
120 /// Asset requests with data which are ready to be sent back to requesters. This includes textures.
121 /// </value>
122 private List<AssetRequest> AssetRequests;
123
124 /// <value>
125 /// Until the asset request is fulfilled, each asset request is associated with a list of requesters
126 /// </value>
127 private Dictionary<UUID, AssetRequestsList> RequestLists;
128 123
129 public IAssetServer AssetServer 124 public IAssetServer AssetServer
130 { 125 {
131 get { return m_assetServer; } 126 get { return m_assetServer; }
132 } 127 }
133 private IAssetServer m_assetServer; 128 private IAssetServer m_assetServer;
129
130 public AssetCache()
131 {
132 m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)");
133 }
134
135 /// <summary>
136 /// Constructor.
137 /// </summary>
138 /// <param name="assetServer"></param>
139 public AssetCache(IAssetServer assetServer)
140 {
141 Initialise(assetServer);
142 }
134 143
135 public void ShowState() 144 public void ShowState()
136 { 145 {
@@ -148,31 +157,20 @@ namespace OpenSim.Framework.Communications.Cache
148 if (StatsManager.SimExtraStats != null) 157 if (StatsManager.SimExtraStats != null)
149 StatsManager.SimExtraStats.ClearAssetCacheStatistics(); 158 StatsManager.SimExtraStats.ClearAssetCacheStatistics();
150 159
151 Initialize(); 160 Reset();
152 } 161 }
153 162
154 /// <summary> 163 /// <summary>
155 /// Initialize the cache. 164 /// Reset the cache.
156 /// </summary> 165 /// </summary>
157 private void Initialize() 166 private void Reset()
158 { 167 {
159 AssetRequests = new List<AssetRequest>(); 168 AssetRequests = new List<AssetRequest>();
160
161 RequestedAssets = new Dictionary<UUID, AssetRequest>(); 169 RequestedAssets = new Dictionary<UUID, AssetRequest>();
162 RequestLists = new Dictionary<UUID, AssetRequestsList>(); 170 RequestLists = new Dictionary<UUID, AssetRequestsList>();
163 } 171 }
164 172
165 /// <summary> 173 /// <summary>
166 /// Constructor. Initialize will need to be called separately.
167 /// </summary>
168 /// <param name="assetServer"></param>
169 public AssetCache(IAssetServer assetServer)
170 {
171 m_log.Info("[ASSET CACHE]: Asset cache direct constructor");
172 Initialise(assetServer);
173 }
174
175 /// <summary>
176 /// Process the asset queue which holds data which is packeted up and sent 174 /// Process the asset queue which holds data which is packeted up and sent
177 /// directly back to the client. 175 /// directly back to the client.
178 /// </summary> 176 /// </summary>
@@ -550,7 +548,6 @@ namespace OpenSim.Framework.Communications.Cache
550 req2.RequestAssetID = req.RequestAssetID; 548 req2.RequestAssetID = req.RequestAssetID;
551 req2.TransferRequestID = req.TransferRequestID; 549 req2.TransferRequestID = req.TransferRequestID;
552 req.RequestUser.SendAsset(req2); 550 req.RequestUser.SendAsset(req2);
553
554 } 551 }
555 } 552 }
556 553