Package com.jme3.asset.cache
Class SimpleAssetCache
java.lang.Object
com.jme3.asset.cache.SimpleAssetCache
- All Implemented Interfaces:
- AssetCache
SimpleAssetCache is an asset cache
 that caches assets without any automatic removal policy. The user
 is expected to manually call deleteFromCache(com.jme3.asset.AssetKey)
 to delete any assets.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription<T> voidaddToCache(AssetKey<T> key, T obj) Adds an asset to the cache.voidDeletes all assets from the cache.booleandeleteFromCache(AssetKey key) Deletes an asset from the cache.<T> TgetFromCache(AssetKey<T> key) Retrieves an asset from the cache.voidNotifies the cache that even though the methodsAssetCache.addToCache(com.jme3.asset.AssetKey, java.lang.Object)orAssetCache.getFromCache(com.jme3.asset.AssetKey)were used, there won't be a call toAssetCache.registerAssetClone(com.jme3.asset.AssetKey, java.lang.Object)for some reason.<T> voidregisterAssetClone(AssetKey<T> key, T clone) This should be called by the asset manager when it has successfully acquired a cached asset (withAssetCache.getFromCache(com.jme3.asset.AssetKey)) and cloned it for use.
- 
Constructor Details- 
SimpleAssetCachepublic SimpleAssetCache()
 
- 
- 
Method Details- 
addToCacheDescription copied from interface:AssetCacheAdds an asset to the cache. Once added, it should be possible to retrieve the asset by using theAssetCache.getFromCache(com.jme3.asset.AssetKey)method. However, the caching criteria may at some point decide that the asset should be removed from the cache to save memory. In that case,AssetCache.getFromCache(com.jme3.asset.AssetKey)will return null.Thread-Safe - Specified by:
- addToCachein interface- AssetCache
- Type Parameters:
- T- The type of the asset to cache.
- Parameters:
- key- The asset key that can be used to look up the asset.
- obj- The asset data to cache.
 
- 
registerAssetCloneDescription copied from interface:AssetCacheThis should be called by the asset manager when it has successfully acquired a cached asset (withAssetCache.getFromCache(com.jme3.asset.AssetKey)) and cloned it for use.Thread-Safe - Specified by:
- registerAssetClonein interface- AssetCache
- Type Parameters:
- T- The type of the asset to register.
- Parameters:
- key- The asset key of the loaded asset (used to retrieve from cache)
- clone- The clone of the asset retrieved from the cache.
 
- 
getFromCacheDescription copied from interface:AssetCacheRetrieves an asset from the cache. It is possible to add an asset to the cache usingAssetCache.addToCache(com.jme3.asset.AssetKey, java.lang.Object). The asset may be removed from the cache automatically even if it was added previously, in that case, this method will return null.Thread-Safe - Specified by:
- getFromCachein interface- AssetCache
- Type Parameters:
- T- The type of the asset to retrieve
- Parameters:
- key- The key used to look up the asset.
- Returns:
- The asset that was previously cached, or null if not found.
 
- 
deleteFromCacheDescription copied from interface:AssetCacheDeletes an asset from the cache.Thread-Safe - Specified by:
- deleteFromCachein interface- AssetCache
- Parameters:
- key- The asset key to find the asset to delete.
- Returns:
- True if the asset was successfully found in the cache and removed.
 
- 
clearCachepublic void clearCache()Description copied from interface:AssetCacheDeletes all assets from the cache.Thread-Safe - Specified by:
- clearCachein interface- AssetCache
 
- 
notifyNoAssetClonepublic void notifyNoAssetClone()Description copied from interface:AssetCacheNotifies the cache that even though the methodsAssetCache.addToCache(com.jme3.asset.AssetKey, java.lang.Object)orAssetCache.getFromCache(com.jme3.asset.AssetKey)were used, there won't be a call toAssetCache.registerAssetClone(com.jme3.asset.AssetKey, java.lang.Object)for some reason. For example, if an error occurred during loading or if the addToCache/getFromCache were used from user code.- Specified by:
- notifyNoAssetClonein interface- AssetCache
 
 
-