31 using System.Collections.Generic;
32 using System.Reflection;
35 using OpenSim.Framework;
36 using OpenSim.Region.Framework.Interfaces;
37 using OpenSim.Region.Framework.Scenes;
38 using OpenSim.Services.Interfaces;
42 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"CoreAssetCache")]
45 private static readonly ILog m_log =
47 MethodBase.GetCurrentMethod().DeclaringType);
49 private bool m_Enabled;
50 private Cache m_Cache;
54 get {
return "CoreAssetCache"; }
57 public Type ReplaceableInterface
64 IConfig moduleConfig = source.Configs[
"Modules"];
66 if (moduleConfig != null)
68 string name = moduleConfig.GetString(
"AssetCaching");
73 IConfig assetConfig = source.Configs[
"AssetCache"];
74 if (assetConfig == null)
76 m_log.Error(
"[ASSET CACHE]: AssetCache missing from OpenSim.ini");
83 m_log.Info(
"[ASSET CACHE]: Core asset cache enabled");
85 m_Cache.Size = assetConfig.GetInt(
"CacheBuckets", 32768);
118 return Get(
id) != null;
124 m_Cache.Store(asset.ID, asset);
134 m_Cache.Invalidate(id);
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void Expire(string id)
Expire an asset from the cache.
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
bool Check(string id)
Check whether an asset with the specified id exists in the cache.
Asset class. All Assets are reference by this class or a class derived from this class ...
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void Clear()
Clear the cache.
AssetBase Get(string id)
Get an asset by its id.
void Cache(AssetBase asset)
Cache the specified asset.