C# Class Universe.Services.CenomeMemoryAssetCache

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.

Inheritance: IImprovedAssetCache, IService
Afficher le fichier Open project: Virtual-Universe/Virtual-Universe

Méthodes publiques

Свойство Type Description
DefaultExpirationTime System.TimeSpan

Méthodes publiques

Méthode Description
Cache ( string assetID, AssetBase asset ) : void

Cache asset.

CacheData ( string assetID, byte asset ) : void
Clear ( ) : void

Clear asset cache.

Contains ( string id ) : bool
Expire ( string id ) : void

Expire (remove) asset stored to cache.

FinishedStartup ( ) : void
Get ( string id ) : AssetBase

Get asset stored

Caller should always check that is return value . Cache doesn't guarantee in any situation that asset is stored to it.

Get ( string id, bool &found ) : AssetBase
GetData ( string id, bool &found ) : byte[]
Initialize ( IConfigSource config, IRegistryCore registry ) : void
Start ( IConfigSource config, IRegistryCore registry ) : void

Méthodes protégées

Méthode Description
Initialize ( long maximalSize, int maximalCount, System.TimeSpan expirationTime ) : void

Initialize asset cache module, with custom parameters.

Method Details

Cache() public méthode

Cache asset.
public Cache ( string assetID, AssetBase asset ) : void
assetID string
asset Universe.Framework.Services.ClassHelpers.Assets.AssetBase /// The asset that is being cached. ///
Résultat void

CacheData() public méthode

public CacheData ( string assetID, byte asset ) : void
assetID string
asset byte
Résultat void

Clear() public méthode

Clear asset cache.
public Clear ( ) : void
Résultat void

Contains() public méthode

public Contains ( string id ) : bool
id string
Résultat bool

Expire() public méthode

Expire (remove) asset stored to cache.
public Expire ( string id ) : void
id string /// The expired asset's id. ///
Résultat void

FinishedStartup() public méthode

public FinishedStartup ( ) : void
Résultat void

Get() public méthode

Get asset stored

Caller should always check that is return value . Cache doesn't guarantee in any situation that asset is stored to it.

public Get ( string id ) : AssetBase
id string /// The asset's id. ///
Résultat Universe.Framework.Services.ClassHelpers.Assets.AssetBase

Get() public méthode

public Get ( string id, bool &found ) : AssetBase
id string
found bool
Résultat Universe.Framework.Services.ClassHelpers.Assets.AssetBase

GetData() public méthode

public GetData ( string id, bool &found ) : byte[]
id string
found bool
Résultat byte[]

Initialize() public méthode

public Initialize ( IConfigSource config, IRegistryCore registry ) : void
config IConfigSource
registry IRegistryCore
Résultat void

Initialize() protected méthode

Initialize asset cache module, with custom parameters.
protected Initialize ( long maximalSize, int maximalCount, System.TimeSpan expirationTime ) : void
maximalSize long /// Cache's maximal size in bytes. ///
maximalCount int /// Cache's maximal count of assets. ///
expirationTime System.TimeSpan /// Asset's expiration time. ///
Résultat void

Start() public méthode

public Start ( IConfigSource config, IRegistryCore registry ) : void
config IConfigSource
registry IRegistryCore
Résultat void

Property Details

DefaultExpirationTime public_oe static_oe property

Asset's default expiration time in the cache.
public static TimeSpan,System DefaultExpirationTime
Résultat System.TimeSpan