Caches.getresource not generated?

Until yesterday, my Hugo was v0.128.2. My Hugo uses the resources.GetRemote function to read external JSON files to build the site’s pages. The cache settings are as follows in hugo.toml

[caches]
    [caches.getresource]
        dir = ':resourceDir/_gen'
        maxAge = -1

I noticed that the cache has not been generated for a while now.

So, I decided to downgrade Hugo to a previous version using the method described in How to downgrade hugo to a previous version? - support - HUGO

I was able to confirm that the cache is properly generated for v0.126.3. On the other hand, v0.127.0 and later do not seem to generate a cache.

I am currently running Hugo with v0.126.3. I may be missing something. Please advise.

I am unable to reproduce the problem as described with v0.127.0 and later.

Example:

git clone --single-branch -b hugo-forum-topic-50656 https://github.com/jmooring/hugo-testing hugo-forum-topic-50656
cd hugo-forum-topic-50656
rm -rf resources && hugo && tree resources

result:

resources/
└── _gen/
    └── getresource/
        └── 2517122314276953446

Thank you very much for your reply. I git cloned the Hugo site you created to my computer. I confirmed that the cache is indeed generated.

So, I tried several cases. As a result, I found that the phenomenon is occurring for a specific API that I access.

In other words, when accessing that API and reading a JSON file, Hugo v0.126.3 generates a cache, but Hugo v0.128.2 does not seem to generate a cache. The above git cloned Hugo site also behaves like that.

This API, however, requires member registration and acquisition of an app ID in order to access it. Therefore, I cannot let you try it out and check it.

Note that nothing has changed in the specifications of the API in question during this period.

I am not sure what to do, but I may have to use Hugo v0.126.3 for the time being. If any ideas, please let me know. Thank you.

Additional Notes. I accessed the API in question and read the JSON file, then, I opened and checked the cache generated by Hugo v0.126.3. At the beginning of the file was the following,

HTTP/1.1 200 200
Connection: close
Access-Control-Allow-Origin: *
Cache-Control: no-store
Content-Type: application/json;charset=UTF-8
Date: Fri, 12 Jul 2024 03:36:26 GMT
Server: Apache
Vary: Accept-Encoding

Is the “Cache-Control: no-store” in line 4 the key point? I may be misunderstanding, but Hugo v0.128.2 strictly supports “no-store”, and Hugo v0.126.3 does not?

However, the help web page for this API states that caching is allowed.

I have thought again. For the future, I will upgrade Hugo to the latest version, and will consider some other approach for the API and Cache. Thank you very much.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.