summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/IContentHelper.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-07-23 17:36:31 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-07-23 17:36:31 -0400
commit467ad2ffd45f7c034b89b668883bb5271524821d (patch)
treefc97dd9b6f2166fbe7070cd21949157316b4533d /src/StardewModdingAPI/IContentHelper.cs
parent4ea6a4102bb69b72391334c4825bd393eff6ac97 (diff)
downloadSMAPI-467ad2ffd45f7c034b89b668883bb5271524821d.tar.gz
SMAPI-467ad2ffd45f7c034b89b668883bb5271524821d.tar.bz2
SMAPI-467ad2ffd45f7c034b89b668883bb5271524821d.zip
let mods invalidate cached assets by name or type (#335)
Diffstat (limited to 'src/StardewModdingAPI/IContentHelper.cs')
-rw-r--r--src/StardewModdingAPI/IContentHelper.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/IContentHelper.cs b/src/StardewModdingAPI/IContentHelper.cs
index 32a9ff19..9fe29e4d 100644
--- a/src/StardewModdingAPI/IContentHelper.cs
+++ b/src/StardewModdingAPI/IContentHelper.cs
@@ -20,5 +20,19 @@ namespace StardewModdingAPI
/// <param name="source">Where to search for a matching content asset.</param>
/// <exception cref="ArgumentException">The <paramref name="key"/> is empty or contains invalid characters.</exception>
string GetActualAssetKey(string key, ContentSource source = ContentSource.ModFolder);
+
+#if !SMAPI_1_x
+ /// <summary>Remove an asset from the content cache so it's reloaded on the next request. This will reload core game assets if needed, but references to the former asset will still show the previous content.</summary>
+ /// <param name="key">The asset key to fetch (if the <paramref name="source"/> is <see cref="ContentSource.GameContent"/>), or the local path to a content file relative to the mod folder.</param>
+ /// <param name="source">Where to search for a matching content asset.</param>
+ /// <exception cref="ArgumentException">The <paramref name="key"/> is empty or contains invalid characters.</exception>
+ /// <returns>Returns whether the given asset key was cached.</returns>
+ bool InvalidateCache(string key, ContentSource source = ContentSource.ModFolder);
+
+ /// <summary>Remove all assets of the given type from the cache so they're reloaded on the next request. <b>This can be a very expensive operation and should only be used in very specific cases.</b> This will reload core game assets if needed, but references to the former assets will still show the previous content.</summary>
+ /// <typeparam name="T">The asset type to remove from the cache.</typeparam>
+ /// <returns>Returns whether any assets were invalidated.</returns>
+ bool InvalidateCache<T>();
+#endif
}
}