From 721988adcd5a38607cb0ff5495f2984e7efb9761 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 30 Jun 2008 15:05:30 +0000 Subject: add the ability to cherry pick expire something from the asset cache. Bandaid until we rethink the caches a bit more. --- .../Framework/Communications/Cache/AssetCache.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 2c51160..95af28b 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -382,6 +382,30 @@ namespace OpenSim.Framework.Communications.Cache } } + /// + /// Allows you to clear a specific asset by uuid out + /// of the asset cache. This is needed because the osdynamic + /// texture code grows the asset cache without bounds. The + /// real solution here is a much better cache archicture, but + /// this is a stop gap measure until we have such a thing. + /// + + public void ExpireAsset(LLUUID uuid) + { + // uuid is unique, so no need to worry about it showing up + // in the 2 caches differently. Also, locks are probably + // needed in all of this, or move to synchronized non + // generic forms for Dictionaries. + if (Textures.ContainsKey(uuid)) + { + Textures.Remove(uuid); + } + else if (Assets.ContainsKey(uuid)) + { + Assets.Remove(uuid); + } + } + // See IAssetReceiver public void AssetReceived(AssetBase asset, bool IsTexture) { -- cgit v1.1