Open wojtha opened 8 years ago
However this won't work anyway if cache is refreshed in other process (e.g. via scheduled rake task). So some sort of cache id or lock is needed so JSONVAT in other process can see that its rates collection is outdated. The most simplistic candidate is file timestamp in case of file cache. Other candidate is the version ID but in this case the jsonvat file needs to be parsed during each check. Third candidate could be file checksum.
When calling
JSONVAT.cache
the rates collection isn't affected as it is memoized inside therates
method and JSONVAT serves old data. I've addedreset_rates
which allows manual cleanup of memoized rates and it is also called from inside thecache
method.