BaseMax / bonbast-api

Dollar and Euro: Live irr exchange rates in free market - bonbast.com
https://www.bonbast.com
MIT License
2 stars 2 forks source link

fix: throw proper exception when IP is blacklisted #4

Closed Scrip7 closed 3 years ago

Scrip7 commented 3 years ago

Hey, This PR helps in debugging process of #3

When the IP is blocked, Google cloud will return the response below:

image

BaseMax commented 3 years ago

Do we need a cache mechanism to cache data and another script to update the cache? After that we can run the cache-updater script using crontab.

BaseMax commented 3 years ago

Thanks

Scrip7 commented 3 years ago

Do we need a cache mechanism to cache data and another script to update the cache? After that, we can run the cache-updater script using crontab.

That caching feature requires you to change the whole API of the package, which currently works as a simple bonbast() function. You have to change it to a class so the end-user can create an object from it. So, we can cache the key in the object property, Right?

That means there will be another Major "v3.x.x" release, and everyone has to update their codes again.

The caching mechanism comes in handy only if when we know how long is the TTL of the dynamic Keys. If they live long enough and they won't expire per X amount of requests, sure we can implement the caching feature.

Other than that, I wouldn't recommend you to add caching feature till we get more details about it.