OpenSim
|
Cenome memory asset cache. More...
Public Member Functions | |
bool | Check (string id) |
Check whether an asset with the specified id exists in the cache. More... | |
void | Cache (AssetBase asset) |
Cache asset. More... | |
void | Clear () |
Clear asset cache. More... | |
void | Expire (string id) |
Expire (remove) asset stored to cache. More... | |
AssetBase | Get (string id) |
Get asset stored More... | |
void | AddRegion (Scene scene) |
New region is being added to server. More... | |
void | Close () |
Close region module. More... | |
void | Initialise (IConfigSource source) |
Initialize region module. More... | |
void | PostInitialise () |
Initialization post handling. More... | |
void | RegionLoaded (Scene scene) |
Region has been loaded. More... | |
void | RemoveRegion (Scene scene) |
Region is being removed. More... | |
Public Attributes | |
const int | DefaultMaxCount = 4096 |
Cache's default maximal asset count. More... | |
const long | DefaultMaxSize = 134217728 |
Default maximal size of the cache in bytes More... | |
Static Public Attributes | |
static readonly TimeSpan | DefaultExpirationTime = TimeSpan.FromMinutes(30.0) |
Asset's default expiration time in the cache. More... | |
Protected Member Functions | |
void | Initialize (long maximalSize, int maximalCount, TimeSpan expirationTime) |
Initialize asset cache module, with custom parameters. More... | |
Properties | |
string | Name [get] |
Gets region module's name. More... | |
Type | ReplaceableInterface [get] |
Properties inherited from OpenSim.Region.Framework.Interfaces.IRegionModuleBase | |
string | Name [get] |
Type | ReplaceableInterface [get] |
If this returns non-null, it is the type of an interface that this module intends to register. This will cause the loader to defer loading of this module until all other modules have been loaded. If no other module has registered the interface by then, this module will be activated, else it will remain inactive, letting the other module take over. This should return non-null ONLY in modules that are intended to be easily replaceable, e.g. stub implementations that the developer expects to be replaced by third party provided modules. More... | |
Cenome memory asset cache.
Cache is enabled by setting "AssetCaching" configuration to value "CenomeMemoryAssetCache". When cache is successfully enable log should have message "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = XXX bytes, MaxCount = XXX, ExpirationTime = XXX)".
Cache's size is limited by two parameters: maximal allowed size in bytes and maximal allowed asset count. When new asset is added to cache that have achieved either size or count limitation, cache will automatically remove less recently used assets from cache. Additionally asset's lifetime is controlled by expiration time.
Configuration | Description |
---|---|
MaxSize | Maximal size of the cache in bytes. Default value: 128MB (134 217 728 bytes). |
MaxCount | Maximal count of assets stored to cache. Default value: 4096 assets. |
ExpirationTime | Asset's expiration time in minutes. Default value: 30 minutes. |
Enabling Cenome Asset Cache:
Setting size and expiration time limitations:
Definition at line 94 of file CenomeAssetCache.cs.
|
inline |
New region is being added to server.
scene | Region's scene. |
Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.
Definition at line 308 of file CenomeAssetCache.cs.
|
inline |
Cache asset.
asset | The asset that is being cached. |
Implements OpenSim.Framework.IImprovedAssetCache.
Definition at line 211 of file CenomeAssetCache.cs.
|
inline |
Check whether an asset with the specified id exists in the cache.
id |
Implements OpenSim.Framework.IImprovedAssetCache.
Definition at line 197 of file CenomeAssetCache.cs.
|
inline |
Clear asset cache.
Implements OpenSim.Framework.IImprovedAssetCache.
Definition at line 227 of file CenomeAssetCache.cs.
|
inline |
Close region module.
Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.
Definition at line 317 of file CenomeAssetCache.cs.
|
inline |
Expire (remove) asset stored to cache.
id | The expired asset's id. |
Implements OpenSim.Framework.IImprovedAssetCache.
Definition at line 238 of file CenomeAssetCache.cs.
|
inline |
Get asset stored
id | The asset's id. |
Caller should always check that is return value . Cache doesn't guarantee in any situation that asset is stored to it.
Implements OpenSim.Framework.IImprovedAssetCache.
Definition at line 258 of file CenomeAssetCache.cs.
|
inline |
Initialize region module.
source | Configuration source. |
Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.
Definition at line 333 of file CenomeAssetCache.cs.
|
inlineprotected |
Initialize asset cache module, with custom parameters.
maximalSize | Cache's maximal size in bytes. |
maximalCount | Cache's maximal count of assets. |
expirationTime | Asset's expiration time. |
Definition at line 168 of file CenomeAssetCache.cs.
|
inline |
Initialization post handling.
Modules can use this to initialize connection with other modules.
Implements OpenSim.Region.Framework.Interfaces.ISharedRegionModule.
Definition at line 376 of file CenomeAssetCache.cs.
|
inline |
Region has been loaded.
scene | Region's scene. |
This is needed for all module types. Modules will register Interfaces with scene in AddScene, and will also need a means to access interfaces registered by other modules. Without this extra method, a module attempting to use another modules' interface would be successful only depending on load order, which can't be depended upon, or modules would need to resort to ugly kludges to attempt to request interfaces when needed and unnecessary caching logic repeated in all modules. The extra function stub is just that much cleaner.
Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.
Definition at line 399 of file CenomeAssetCache.cs.
|
inline |
Region is being removed.
scene | Region scene that is being removed. |
Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.
Definition at line 409 of file CenomeAssetCache.cs.
|
static |
Asset's default expiration time in the cache.
Definition at line 121 of file CenomeAssetCache.cs.
const int OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.DefaultMaxCount = 4096 |
Cache's default maximal asset count.
Assuming that average asset size is about 32768 bytes.
Definition at line 106 of file CenomeAssetCache.cs.
const long OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.DefaultMaxSize = 134217728 |
Default maximal size of the cache in bytes
128MB = 128 * 1024^2 = 134 217 728 bytes.
Definition at line 116 of file CenomeAssetCache.cs.
|
get |
Gets region module's name.
Definition at line 293 of file CenomeAssetCache.cs.
|
get |
Definition at line 298 of file CenomeAssetCache.cs.