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

Add automatic cache refresh/verification #15

Open
mauzel opened this issue Mar 30, 2018 · 2 comments
Open

Add automatic cache refresh/verification #15

mauzel opened this issue Mar 30, 2018 · 2 comments
Assignees

Comments

@mauzel
Copy link
Owner

mauzel commented Mar 30, 2018

The cache can get into a bad state or cached assets can get stale.

Let's remove the tediousness of manually fixing cache files and just have a worker thread or process which periodically refreshes and verifies the cache.

@mauzel mauzel self-assigned this Mar 30, 2018
@AkagiShiroe
Copy link
Contributor

a different multi-threaded handler? i was thinking about to load whole ".cache_list" to memory as temporary sources (also throw new cache here).. but talking was easy..

@mauzel
Copy link
Owner Author

mauzel commented Mar 30, 2018

I think your idea is similar to what I was thinking. My general idea is to load the .cache_list into memory and do the following:

  • Purge any cache files which have a timestamp in the original URL, for example, delete any asset where the URL looks like *.granbluefantasy.jp/*?t=*.
  • For all other files, check with the server if the asset was updated on the Granblue server. If it was updated, download and cache the new version.

So, I think this is the same as what you said. However, the reason to do this in a separate worker thread is implementation and performance. I want to keep the logic for the "cache refresh" separated from the proxy server code, and I also don't want to be refreshing the cache while the proxy is busy.

The cache directory gets quite large so I don't want a cache refresh, which could take a long time, to block the normal proxy operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants