Class CacheItem
Represents a cached asset item with its state and metadata.
Tracks the lifecycle of an asset within the prefetch cache system.
Inherited Members
Namespace: Serenity.AssetPrefetcher.Domain.Entities
Assembly: Serenity.AssetPrefetcher.Domain.dll
Syntax
public class CacheItem
Constructors
CacheItem(AssetKey, int)
Initializes a new cache item in the loading state.
Declaration
public CacheItem(AssetKey key, int sizeInBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetKey | key | The asset key for this cache item |
| int | sizeInBytes | The size of the asset in bytes |
Properties
AssetKey
Declaration
public AssetKey AssetKey { get; }
Property Value
| Type | Description |
|---|---|
| AssetKey | The unique key identifying the cached asset. |
AssetRef
Declaration
public Object AssetRef { get; }
Property Value
| Type | Description |
|---|---|
| Object | Reference to the actual Unity asset object (null when not loaded or evicted). |
SizeInBytes
Declaration
public int SizeInBytes { get; }
Property Value
| Type | Description |
|---|---|
| int | Size of the asset in bytes for memory management purposes. |
State
Declaration
public CacheItemState State { get; }
Property Value
| Type | Description |
|---|---|
| CacheItemState | Current state of the cache item in its lifecycle. |
Methods
Evict()
Evicts the cache item, removing the asset reference and marking it as evicted.
Declaration
public void Evict()
SetReady(Object)
Marks the cache item as ready and associates it with the loaded asset.
Declaration
public void SetReady(Object asset)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | asset | The loaded Unity asset object |