C# 클래스 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.

상속: IImprovedAssetCache, IService
파일 보기 프로젝트 열기: Virtual-Universe/Virtual-Universe

공개 프로퍼티들

프로퍼티 타입 설명
DefaultExpirationTime System.TimeSpan

공개 메소드들

메소드 설명
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

보호된 메소드들

메소드 설명
Initialize ( long maximalSize, int maximalCount, System.TimeSpan expirationTime ) : void

Initialize asset cache module, with custom parameters.

메소드 상세

Cache() 공개 메소드

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

CacheData() 공개 메소드

public CacheData ( string assetID, byte asset ) : void
assetID string
asset byte
리턴 void

Clear() 공개 메소드

Clear asset cache.
public Clear ( ) : void
리턴 void

Contains() 공개 메소드

public Contains ( string id ) : bool
id string
리턴 bool

Expire() 공개 메소드

Expire (remove) asset stored to cache.
public Expire ( string id ) : void
id string /// The expired asset's id. ///
리턴 void

FinishedStartup() 공개 메소드

public FinishedStartup ( ) : void
리턴 void

Get() 공개 메소드

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. ///
리턴 Universe.Framework.Services.ClassHelpers.Assets.AssetBase

Get() 공개 메소드

public Get ( string id, bool &found ) : AssetBase
id string
found bool
리턴 Universe.Framework.Services.ClassHelpers.Assets.AssetBase

GetData() 공개 메소드

public GetData ( string id, bool &found ) : byte[]
id string
found bool
리턴 byte[]

Initialize() 공개 메소드

public Initialize ( IConfigSource config, IRegistryCore registry ) : void
config IConfigSource
registry IRegistryCore
리턴 void

Initialize() 보호된 메소드

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. ///
리턴 void

Start() 공개 메소드

public Start ( IConfigSource config, IRegistryCore registry ) : void
config IConfigSource
registry IRegistryCore
리턴 void

프로퍼티 상세

DefaultExpirationTime 공개적으로 정적으로 프로퍼티

Asset's default expiration time in the cache.
public static TimeSpan,System DefaultExpirationTime
리턴 System.TimeSpan