Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document ResourceLoader load() CacheModes #8434

Closed
lostminds opened this issue Nov 9, 2023 · 2 comments
Closed

Document ResourceLoader load() CacheModes #8434

lostminds opened this issue Nov 9, 2023 · 2 comments
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository enhancement

Comments

@lostminds
Copy link

Your Godot version:
4.2 beta 5

Issue description:
I was trying to figure out more precisely how load() would create new instances of the loaded resource or reuse already loaded instances. I think it's controlled by the optional cachemode parameter(?). However, this feels like an important and useful feature so it would be good if this was explained more explicitly. For example (my additions in italics if my guesses are correct?):

enum CacheMode:
CacheMode CACHE_MODE_IGNORE = 0
Load a new instance from path, regardless if loaded instance already exists in cache.

CacheMode CACHE_MODE_REUSE = 1
Reuse already loaded instance from cache if one exists, otherwise load a new instance.

CacheMode CACHE_MODE_REPLACE = 2
Load a new instance from path and replace the currently cached instance if one exists.

URL to the documentation page (if already existing):
https://docs.godotengine.org/en/stable/classes/class_resourceloader.html#enum-resourceloader-cachemode

@Piralein Piralein added the area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository label Nov 10, 2023
@erik-lance
Copy link

I have the same issues with this. I was figuring out how to use load_threaded_request, and it told me:

The cache_mode property defines whether and how the cache should be used or updated when loading the resource. See CacheMode for details.

Clicking it only led me to the cache mode options without any explanation. It would be nice to have a better understanding of how the caching works.

@YuriSizov
Copy link
Contributor

These constants have been recently documented via godotengine/godot#82884, should appear by next week in the online docs for the latest branch as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository enhancement
Projects
None yet
Development

No branches or pull requests

4 participants