Class AssetCacheSystem
IAssetCache 구현체. Dictionary 기반 에셋 캐시. AssetSystem 내부 전용.
public class AssetCacheSystem : IAssetCache
- Inheritance
-
objectAssetCacheSystem
- Implements
Remarks
동일 key에 대한 중복 Addressables 로드를 방지한다. Release 시 AssetSystem이 Remove를 호출해 캐시와 핸들을 함께 정리한다. [금지] 외부에서 직접 인스턴스화. DI를 통해 IAssetCache로 접근.
Methods
Add<T>(string, T)
에셋을 캐시에 추가. 동일 키 존재 시 덮어쓴다.
public void Add<T>(string key, T asset) where T : Object
Parameters
keystring저장 키.
assetT저장할 에셋.
Type Parameters
T
Contains(string)
해당 키의 캐시 존재 여부.
public bool Contains(string key)
Parameters
keystring
Returns
- bool
Remove(string)
해당 키의 캐시 항목 삭제.
public void Remove(string key)
Parameters
keystring삭제 키.
TryGet<T>(string, out T)
캐시에서 에셋 조회.
public bool TryGet<T>(string key, out T asset) where T : Object
Parameters
keystring조회 키.
assetT조회된 에셋. 없으면 null.
Returns
- bool
캐시 히트 여부.
Type Parameters
T