logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class CacheItem

    Represents a cached asset item with its state and metadata.
    Tracks the lifecycle of an asset within the prefetch cache system.

    Inheritance
    object
    CacheItem
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    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

    In this article
    © 2026 Serenity. All Rights Reserved