OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Properties | List of all members
OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache Class Reference

Cenome memory asset cache. More...

Inheritance diagram for OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache:
Inheritance graph
[legend]
Collaboration diagram for OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache:
Collaboration graph
[legend]

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...
 

Detailed Description

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:

[Modules]
AssetCaching = "CenomeMemoryAssetCache"

Setting size and expiration time limitations:

[AssetCache]
; 256 MB (default: 134217728)
MaxSize = 268435456
; How many assets it is possible to store cache (default: 4096)
MaxCount = 16384
; Expiration time - 1 hour (default: 30 minutes)
ExpirationTime = 60

Definition at line 94 of file CenomeAssetCache.cs.

Member Function Documentation

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.AddRegion ( Scene  scene)
inline

New region is being added to server.

Parameters
sceneRegion's scene.

Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.

Definition at line 308 of file CenomeAssetCache.cs.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Cache ( AssetBase  asset)
inline

Cache asset.

Parameters
assetThe asset that is being cached.

Implements OpenSim.Framework.IImprovedAssetCache.

Definition at line 211 of file CenomeAssetCache.cs.

bool OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Check ( string  id)
inline

Check whether an asset with the specified id exists in the cache.

Parameters
id

Implements OpenSim.Framework.IImprovedAssetCache.

Definition at line 197 of file CenomeAssetCache.cs.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Clear ( )
inline

Clear asset cache.

Implements OpenSim.Framework.IImprovedAssetCache.

Definition at line 227 of file CenomeAssetCache.cs.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Close ( )
inline

Close region module.

Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.

Definition at line 317 of file CenomeAssetCache.cs.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Expire ( string  id)
inline

Expire (remove) asset stored to cache.

Parameters
idThe expired asset's id.

Implements OpenSim.Framework.IImprovedAssetCache.

Definition at line 238 of file CenomeAssetCache.cs.

AssetBase OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Get ( string  id)
inline

Get asset stored

Parameters
idThe asset's id.
Returns
Asset if it is found from cache; otherwise .

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.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Initialise ( IConfigSource  source)
inline

Initialize region module.

Parameters
sourceConfiguration source.

Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.

Definition at line 333 of file CenomeAssetCache.cs.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Initialize ( long  maximalSize,
int  maximalCount,
TimeSpan  expirationTime 
)
inlineprotected

Initialize asset cache module, with custom parameters.

Parameters
maximalSizeCache's maximal size in bytes.
maximalCountCache's maximal count of assets.
expirationTimeAsset's expiration time.

Definition at line 168 of file CenomeAssetCache.cs.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.PostInitialise ( )
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.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.RegionLoaded ( Scene  scene)
inline

Region has been loaded.

Parameters
sceneRegion'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.

void OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.RemoveRegion ( Scene  scene)
inline

Region is being removed.

Parameters
sceneRegion scene that is being removed.

Implements OpenSim.Region.Framework.Interfaces.IRegionModuleBase.

Definition at line 409 of file CenomeAssetCache.cs.

Member Data Documentation

readonly TimeSpan OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.DefaultExpirationTime = TimeSpan.FromMinutes(30.0)
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.

Property Documentation

string OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.Name
get

Gets region module's name.

Definition at line 293 of file CenomeAssetCache.cs.

Type OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache.ReplaceableInterface
get

Definition at line 298 of file CenomeAssetCache.cs.


The documentation for this class was generated from the following file: