aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJeff Ames2009-05-27 14:30:33 +0000
committerJeff Ames2009-05-27 14:30:33 +0000
commita576cca59e1478c4a3b963fe0ee7d64d5030a158 (patch)
tree97266b6ab58b426ab76bd534f12f7ca79a74d872 /OpenSim/Region/CoreModules
parentRevert "* Added IntegrationTest Attribute and tagged the ODETestClass" (diff)
downloadopensim-SC_OLD-a576cca59e1478c4a3b963fe0ee7d64d5030a158.zip
opensim-SC_OLD-a576cca59e1478c4a3b963fe0ee7d64d5030a158.tar.gz
opensim-SC_OLD-a576cca59e1478c4a3b963fe0ee7d64d5030a158.tar.bz2
opensim-SC_OLD-a576cca59e1478c4a3b963fe0ee7d64d5030a158.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs252
1 files changed, 126 insertions, 126 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index f0a43b0..df65226 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -1,126 +1,126 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net; 28using log4net;
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using GlynnTucker.Cache; 33using GlynnTucker.Cache;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40namespace OpenSim.Region.CoreModules.Asset 40namespace OpenSim.Region.CoreModules.Asset
41{ 41{
42 public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache 42 public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache
43 { 43 {
44 private static readonly ILog m_log = 44 private static readonly ILog m_log =
45 LogManager.GetLogger( 45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType); 46 MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private bool m_Enabled = false; 48 private bool m_Enabled = false;
49 private ICache m_Cache = new GlynnTucker.Cache.SimpleMemoryCache(); 49 private ICache m_Cache = new GlynnTucker.Cache.SimpleMemoryCache();
50 50
51 public string Name 51 public string Name
52 { 52 {
53 get { return "GlynnTuckerAssetCache"; } 53 get { return "GlynnTuckerAssetCache"; }
54 } 54 }
55 55
56 public void Initialise(IConfigSource source) 56 public void Initialise(IConfigSource source)
57 { 57 {
58 IConfig moduleConfig = source.Configs["Modules"]; 58 IConfig moduleConfig = source.Configs["Modules"];
59 59
60 if (moduleConfig != null) 60 if (moduleConfig != null)
61 { 61 {
62 string name = moduleConfig.GetString("AssetCaching", "GlynnTuckerAssetCache"); 62 string name = moduleConfig.GetString("AssetCaching", "GlynnTuckerAssetCache");
63 m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 63 m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
64 64
65 if (name == Name) 65 if (name == Name)
66 { 66 {
67 m_Enabled = true; 67 m_Enabled = true;
68 68
69 m_log.Info("[ASSET CACHE]: GlynnTucker asset cache enabled"); 69 m_log.Info("[ASSET CACHE]: GlynnTucker asset cache enabled");
70 70
71 } 71 }
72 } 72 }
73 } 73 }
74 74
75 public void PostInitialise() 75 public void PostInitialise()
76 { 76 {
77 } 77 }
78 78
79 public void Close() 79 public void Close()
80 { 80 {
81 } 81 }
82 82
83 public void AddRegion(Scene scene) 83 public void AddRegion(Scene scene)
84 { 84 {
85 if (m_Enabled) 85 if (m_Enabled)
86 scene.RegisterModuleInterface<IImprovedAssetCache>(this); 86 scene.RegisterModuleInterface<IImprovedAssetCache>(this);
87 } 87 }
88 88
89 public void RemoveRegion(Scene scene) 89 public void RemoveRegion(Scene scene)
90 { 90 {
91 } 91 }
92 92
93 public void RegionLoaded(Scene scene) 93 public void RegionLoaded(Scene scene)
94 { 94 {
95 } 95 }
96 96
97 //////////////////////////////////////////////////////////// 97 ////////////////////////////////////////////////////////////
98 // IImprovedAssetCache 98 // IImprovedAssetCache
99 // 99 //
100 100
101 public void Cache(AssetBase asset) 101 public void Cache(AssetBase asset)
102 { 102 {
103 if (asset != null) 103 if (asset != null)
104 m_Cache.AddOrUpdate(asset.ID, asset); 104 m_Cache.AddOrUpdate(asset.ID, asset);
105 } 105 }
106 106
107 public AssetBase Get(string id) 107 public AssetBase Get(string id)
108 { 108 {
109 Object asset = null; 109 Object asset = null;
110 m_Cache.TryGet(id, out asset); 110 m_Cache.TryGet(id, out asset);
111 return (AssetBase)asset; 111 return (AssetBase)asset;
112 } 112 }
113 113
114 public void Expire(string id) 114 public void Expire(string id)
115 { 115 {
116 Object asset = null; 116 Object asset = null;
117 if (m_Cache.TryGet(id, out asset)) 117 if (m_Cache.TryGet(id, out asset))
118 m_Cache.Remove(id); 118 m_Cache.Remove(id);
119 } 119 }
120 120
121 public void Clear() 121 public void Clear()
122 { 122 {
123 m_Cache.Clear(); 123 m_Cache.Clear();
124 } 124 }
125 } 125 }
126} 126}