Upgraded the Simian inventory connector with an item cache, too, so that it doesn't get awfully out of sync with the improvements I'm making to the robust service connectors, which are being fully leveraged by the simulator. This Simian connector needs more love...
parent
96f0c6f074
commit
c4efeb0f7c
|
@ -74,6 +74,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
// private object m_gestureSyncRoot = new object();
|
// private object m_gestureSyncRoot = new object();
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
|
private const double CACHE_EXPIRATION_SECONDS = 20.0;
|
||||||
|
private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache;
|
||||||
|
|
||||||
#region ISharedRegionModule
|
#region ISharedRegionModule
|
||||||
|
|
||||||
public Type ReplaceableInterface { get { return null; } }
|
public Type ReplaceableInterface { get { return null; } }
|
||||||
|
@ -99,6 +102,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
url = url + '/';
|
url = url + '/';
|
||||||
m_serverUrl = url;
|
m_serverUrl = url;
|
||||||
|
|
||||||
|
if (m_ItemCache == null)
|
||||||
|
m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
@ -132,6 +138,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{
|
{
|
||||||
m_userServerUrl = serviceUrl;
|
m_userServerUrl = serviceUrl;
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
|
if (m_ItemCache == null)
|
||||||
|
m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,6 +279,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public InventoryItemBase GetItem(InventoryItemBase item)
|
public InventoryItemBase GetItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
InventoryItemBase retrieved = null;
|
||||||
|
if (m_ItemCache.TryGetValue(item.ID, out retrieved))
|
||||||
|
return retrieved;
|
||||||
|
|
||||||
NameValueCollection requestArgs = new NameValueCollection
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
{
|
{
|
||||||
{ "RequestMethod", "GetInventoryNode" },
|
{ "RequestMethod", "GetInventoryNode" },
|
||||||
|
@ -292,7 +304,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
for (int i = 0; i < items.Count; i++)
|
for (int i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
if (items[i].ID == item.ID)
|
if (items[i].ID == item.ID)
|
||||||
return items[i];
|
{
|
||||||
|
retrieved = items[i];
|
||||||
|
m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS);
|
||||||
|
return retrieved;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue