You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a very nice tool, thank you! I hope to use it to replace my own home-grown version of roughly the same thing.
One thing I noticed is that the cache file ~/.cache/cloudflare-dyndns/ip.cache gets overwritten on every invocation of the program, even if nothing has changed. It's just a few hundred bytes, yes, but on flash storage this equates to at least a 4kB or more write depending on the hardware and filesystem. In the grand scheme of things, very likely not a big deal, but it would be nice to do the right thing if possible.
I haven't had the time to fully understand the flow of things, but two approaches that I can think of:
Track changes to the cache somehow and mark the cache as "dirty" when a value is written. Then, only write when the cache is dirty.
Before writing the cache file, read the existing file and compare the JSON. Only trigger a write when they differ.
One workaround for those who are concerned about unnecessary writes could be to store the cache file on a RAM-backed filesystem, e.g. /dev/shm/ip.cache.
The text was updated successfully, but these errors were encountered:
cu
changed the title
overwrite cache only when changed
cache is ovewritten even when not changed
Aug 26, 2023
cu
changed the title
cache is ovewritten even when not changed
cache is overwritten even when not changed
Aug 26, 2023
This is a very nice tool, thank you! I hope to use it to replace my own home-grown version of roughly the same thing.
One thing I noticed is that the cache file
~/.cache/cloudflare-dyndns/ip.cache
gets overwritten on every invocation of the program, even if nothing has changed. It's just a few hundred bytes, yes, but on flash storage this equates to at least a 4kB or more write depending on the hardware and filesystem. In the grand scheme of things, very likely not a big deal, but it would be nice to do the right thing if possible.I haven't had the time to fully understand the flow of things, but two approaches that I can think of:
One workaround for those who are concerned about unnecessary writes could be to store the cache file on a RAM-backed filesystem, e.g.
/dev/shm/ip.cache
.The text was updated successfully, but these errors were encountered: