aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectors
diff options
context:
space:
mode:
authorMelanie Thielker2009-05-10 12:27:05 +0000
committerMelanie Thielker2009-05-10 12:27:05 +0000
commitd8e1842d2507b2c18b21671ed01496b3a2c59e18 (patch)
tree2ae57cf45dd1b22fe48b72b85c952258d87f60b6 /OpenSim/Region/CoreModules/ServiceConnectors
parentFix the build break (diff)
downloadopensim-SC_OLD-d8e1842d2507b2c18b21671ed01496b3a2c59e18.zip
opensim-SC_OLD-d8e1842d2507b2c18b21671ed01496b3a2c59e18.tar.gz
opensim-SC_OLD-d8e1842d2507b2c18b21671ed01496b3a2c59e18.tar.bz2
opensim-SC_OLD-d8e1842d2507b2c18b21671ed01496b3a2c59e18.tar.xz
Add some asset cache plumbing. Change the generic cache from UUID to string
keys to allow caching the new crop of URI identified objects.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs23
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs19
2 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
index 24ac8be..0a0f634 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
@@ -28,6 +28,7 @@
28using log4net; 28using log4net;
29using Nini.Config; 29using Nini.Config;
30using System; 30using System;
31using System.Collections.Generic;
31using System.Reflection; 32using System.Reflection;
32using OpenSim.Servers.Base; 33using OpenSim.Servers.Base;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
@@ -42,6 +43,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
42 LogManager.GetLogger( 43 LogManager.GetLogger(
43 MethodBase.GetCurrentMethod().DeclaringType); 44 MethodBase.GetCurrentMethod().DeclaringType);
44 45
46 private Dictionary<Scene, IImprovedAssetCache> m_AssetCache =
47 new Dictionary<Scene, IImprovedAssetCache>();
48
45 private IAssetService m_AssetService; 49 private IAssetService m_AssetService;
46 50
47 private bool m_Enabled = false; 51 private bool m_Enabled = false;
@@ -109,10 +113,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
109 113
110 public void RemoveRegion(Scene scene) 114 public void RemoveRegion(Scene scene)
111 { 115 {
116 if (!m_Enabled)
117 return;
118
119 m_AssetCache.Remove(scene);
112 } 120 }
113 121
114 public void RegionLoaded(Scene scene) 122 public void RegionLoaded(Scene scene)
115 { 123 {
124 if (!m_Enabled)
125 return;
126
127 m_AssetCache[scene] =
128 scene.RequestModuleInterface<IImprovedAssetCache>();
129
130 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName);
131
132 m_AssetCache[scene] =
133 scene.RequestModuleInterface<IImprovedAssetCache>();
134
135 if (m_AssetCache[scene] != null)
136 {
137 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName);
138 }
116 } 139 }
117 } 140 }
118} 141}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs
index 2cc2962..835678d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs
@@ -27,6 +27,7 @@
27 27
28using log4net; 28using log4net;
29using System; 29using System;
30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Reflection; 32using System.Reflection;
32using Nini.Config; 33using Nini.Config;
@@ -48,6 +49,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
48 49
49 private bool m_Enabled = false; 50 private bool m_Enabled = false;
50 private string m_ServerURI = String.Empty; 51 private string m_ServerURI = String.Empty;
52 private Dictionary<Scene, IImprovedAssetCache> m_AssetCache =
53 new Dictionary<Scene, IImprovedAssetCache>();
51 54
52 public string Name 55 public string Name
53 { 56 {
@@ -103,10 +106,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
103 106
104 public void RemoveRegion(Scene scene) 107 public void RemoveRegion(Scene scene)
105 { 108 {
109 if (!m_Enabled)
110 return;
111
112 m_AssetCache.Remove(scene);
106 } 113 }
107 114
108 public void RegionLoaded(Scene scene) 115 public void RegionLoaded(Scene scene)
109 { 116 {
117 if (!m_Enabled)
118 return;
119
120 m_AssetCache[scene] =
121 scene.RequestModuleInterface<IImprovedAssetCache>();
122
123 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled remote assets for region {0}", scene.RegionInfo.RegionName);
124
125 if (m_AssetCache[scene] != null)
126 {
127 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName);
128 }
110 } 129 }
111 130
112 public AssetBase Get(string id) 131 public AssetBase Get(string id)