diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs index 4e802ed..3750991 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs | |||
@@ -146,7 +146,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
146 | 146 | ||
147 | public AssetBase Get(string id) | 147 | public AssetBase Get(string id) |
148 | { | 148 | { |
149 | AssetBase asset = m_Cache.Get(id); | 149 | AssetBase asset = null; |
150 | if (m_Cache != null) | ||
151 | asset = m_Cache.Get(id); | ||
150 | 152 | ||
151 | if (asset == null) | 153 | if (asset == null) |
152 | return m_AssetService.Get(id); | 154 | return m_AssetService.Get(id); |
@@ -155,15 +157,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
155 | 157 | ||
156 | public AssetMetadata GetMetadata(string id) | 158 | public AssetMetadata GetMetadata(string id) |
157 | { | 159 | { |
158 | AssetBase asset = m_Cache.Get(id); | 160 | AssetBase asset = null; |
161 | if (m_Cache != null) | ||
162 | asset = m_Cache.Get(id); | ||
159 | 163 | ||
160 | if (asset != null) | 164 | if (asset != null) |
161 | return asset.Metadata; | 165 | return asset.Metadata; |
162 | 166 | ||
163 | asset = m_AssetService.Get(id); | 167 | asset = m_AssetService.Get(id); |
164 | if (asset != null) | 168 | if (asset != null) |
165 | { | 169 | { |
166 | m_Cache.Cache(asset); | 170 | if (m_Cache != null) |
171 | m_Cache.Cache(asset); | ||
167 | return asset.Metadata; | 172 | return asset.Metadata; |
168 | } | 173 | } |
169 | 174 | ||
@@ -180,7 +185,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
180 | asset = m_AssetService.Get(id); | 185 | asset = m_AssetService.Get(id); |
181 | if (asset != null) | 186 | if (asset != null) |
182 | { | 187 | { |
183 | m_Cache.Cache(asset); | 188 | if (m_Cache != null) |
189 | m_Cache.Cache(asset); | ||
184 | return asset.Data; | 190 | return asset.Data; |
185 | } | 191 | } |
186 | 192 | ||
@@ -189,7 +195,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
189 | 195 | ||
190 | public bool Get(string id, Object sender, AssetRetrieved handler) | 196 | public bool Get(string id, Object sender, AssetRetrieved handler) |
191 | { | 197 | { |
192 | AssetBase asset = m_Cache.Get(id); | 198 | AssetBase asset = null; |
199 | if (m_Cache != null) | ||
200 | m_Cache.Get(id); | ||
193 | 201 | ||
194 | if (asset != null) | 202 | if (asset != null) |
195 | { | 203 | { |
@@ -199,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
199 | 207 | ||
200 | return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) | 208 | return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) |
201 | { | 209 | { |
202 | if (a != null) | 210 | if ((a != null) && (m_Cache != null)) |
203 | m_Cache.Cache(a); | 211 | m_Cache.Cache(a); |
204 | handler(assetID, s, a); | 212 | handler(assetID, s, a); |
205 | }); | 213 | }); |
@@ -207,7 +215,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
207 | 215 | ||
208 | public string Store(AssetBase asset) | 216 | public string Store(AssetBase asset) |
209 | { | 217 | { |
210 | m_Cache.Cache(asset); | 218 | if (m_Cache != null) |
219 | m_Cache.Cache(asset); | ||
211 | if (asset.Temporary || asset.Local) | 220 | if (asset.Temporary || asset.Local) |
212 | return asset.ID; | 221 | return asset.ID; |
213 | return m_AssetService.Store(asset); | 222 | return m_AssetService.Store(asset); |
@@ -215,11 +224,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
215 | 224 | ||
216 | public bool UpdateContent(string id, byte[] data) | 225 | public bool UpdateContent(string id, byte[] data) |
217 | { | 226 | { |
218 | AssetBase asset = m_Cache.Get(id); | 227 | AssetBase asset = null; |
228 | if (m_Cache != null) | ||
229 | m_Cache.Get(id); | ||
219 | if (asset != null) | 230 | if (asset != null) |
220 | { | 231 | { |
221 | asset.Data = data; | 232 | asset.Data = data; |
222 | m_Cache.Cache(asset); | 233 | if (m_Cache != null) |
234 | m_Cache.Cache(asset); | ||
223 | } | 235 | } |
224 | 236 | ||
225 | return m_AssetService.UpdateContent(id, data); | 237 | return m_AssetService.UpdateContent(id, data); |
@@ -227,7 +239,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
227 | 239 | ||
228 | public bool Delete(string id) | 240 | public bool Delete(string id) |
229 | { | 241 | { |
230 | m_Cache.Expire(id); | 242 | if (m_Cache != null) |
243 | m_Cache.Expire(id); | ||
231 | 244 | ||
232 | return m_AssetService.Delete(id); | 245 | return m_AssetService.Delete(id); |
233 | } | 246 | } |