From ad2bd740574b7695a74bb65a63c4bb884cafdf7d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 14 Apr 2009 16:36:32 +0000 Subject: * refactor: rename AssetCache.Initialize() to AssetCache.Reset() to avoid having Initialise() and Initialize() in the same class - very difficult to read. --- .../Framework/Communications/Cache/AssetCache.cs | 83 +++++++++++----------- 1 file changed, 40 insertions(+), 43 deletions(-) (limited to 'OpenSim/Framework') 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 /// AssetNotFound(), which means they do share the same asset and texture caches. public class AssetCache : IAssetCache { + private static readonly ILog m_log + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected ICache m_memcache = new SimpleMemoryCache(); + + /// + /// Assets requests which are waiting for asset server data. This includes texture requests + /// + private Dictionary RequestedAssets; + + /// + /// Asset requests with data which are ready to be sent back to requesters. This includes textures. + /// + private List AssetRequests; + + /// + /// Until the asset request is fulfilled, each asset request is associated with a list of requesters + /// + private Dictionary RequestLists; + #region IPlugin /// @@ -77,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache m_log.Debug("[ASSET CACHE]: Asset cache server-specified initialisation"); m_log.InfoFormat("[ASSET CACHE]: Asset cache initialisation [{0}/{1}]", Name, Version); - Initialize(); + Reset(); m_assetServer = assetServer; m_assetServer.SetReceiver(this); @@ -95,42 +115,31 @@ namespace OpenSim.Framework.Communications.Cache Initialise(assetServer); } - public AssetCache() - { - m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)"); - } - public void Dispose() { } - #endregion - - protected ICache m_memcache = new SimpleMemoryCache(); - - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// Assets requests which are waiting for asset server data. This includes texture requests - /// - private Dictionary RequestedAssets; - - /// - /// Asset requests with data which are ready to be sent back to requesters. This includes textures. - /// - private List AssetRequests; - - /// - /// Until the asset request is fulfilled, each asset request is associated with a list of requesters - /// - private Dictionary RequestLists; + #endregion public IAssetServer AssetServer { get { return m_assetServer; } } - private IAssetServer m_assetServer; + private IAssetServer m_assetServer; + + public AssetCache() + { + m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)"); + } + + /// + /// Constructor. + /// + /// + public AssetCache(IAssetServer assetServer) + { + Initialise(assetServer); + } public void ShowState() { @@ -148,31 +157,20 @@ namespace OpenSim.Framework.Communications.Cache if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.ClearAssetCacheStatistics(); - Initialize(); + Reset(); } /// - /// Initialize the cache. + /// Reset the cache. /// - private void Initialize() + private void Reset() { AssetRequests = new List(); - RequestedAssets = new Dictionary(); RequestLists = new Dictionary(); } /// - /// Constructor. Initialize will need to be called separately. - /// - /// - public AssetCache(IAssetServer assetServer) - { - m_log.Info("[ASSET CACHE]: Asset cache direct constructor"); - Initialise(assetServer); - } - - /// /// Process the asset queue which holds data which is packeted up and sent /// directly back to the client. /// @@ -550,7 +548,6 @@ namespace OpenSim.Framework.Communications.Cache req2.RequestAssetID = req.RequestAssetID; req2.TransferRequestID = req.TransferRequestID; req.RequestUser.SendAsset(req2); - } } -- cgit v1.1