Skip to content

Class AssetCache

Definition

Namespace: StardewUI.Framework.Content
Assembly: StardewUI.dll

Standard in-game implementation of the asset cache based on SMAPI's helpers and events.

public class AssetCache : StardewUI.Framework.Content.IAssetCache

Inheritance
Object ⇦ AssetCache

Implements
IAssetCache

Members

Constructors

Name Description
AssetCache(IGameContentHelper, IContentEvents) Initializes a new instance of AssetCache.

Methods

Name Description
Get<T>(string) Retrieves the current entry for a given asset name.

Details

Constructors

AssetCache(IGameContentHelper, IContentEvents)

Initializes a new instance of AssetCache.

public AssetCache(StardewModdingAPI.IGameContentHelper content, StardewModdingAPI.Events.IContentEvents events);
Parameters

content   IGameContentHelper
SMAPI content helper, used to load the assets.

events   IContentEvents
SMAPI content events, used to detect invalidation.


Methods

Get<T>(string)

Retrieves the current entry for a given asset name.

public StardewUI.Framework.Content.IAssetCacheEntry<T> Get<T>(string name);
Parameters

name   string
Name of the asset.

Returns

IAssetCacheEntry<T>

A cache entry object that contains the most current asset data, and an expired flag to detect if the asset is no longer valid in the future.

Remarks

If the asset was invalidated by SMAPI and has not yet been reloaded, then this will trigger a reload.