brsbilgic
brsbilgic

Reputation: 11833

Best practice for keeping stable exchange rates for a month

I want to use exchange rates in my application but I do not want to get these rates from a web service.

I just want to keep it in somewhere and read it from there and I want to be able to update that rates month by month.

I may keep data in database easily but because I will use that rates often it may cause to overhead, doesn't it?

I am not sure but I may keep it in XML but I am not sure how it differs from database approach.

I may keep it in the code as hardcoded, definetly the fastest, but I couldn't update it easily.

What is the best practices for doing such operation ?

Upvotes: 1

Views: 320

Answers (2)

Will Hartung
Will Hartung

Reputation: 118714

Store the data in some easy readable file (Properties file if you're using Java, for example. XML if you're comfortable with it, whatever).

When you update the currencies, write the file out. When your app starts up, load the file and keep it in memory.

You're talking a trivial amount of data, so with some simple caching (i.e. read the file once and store and maintain the app as long as its running), you won't notice any real performance impact.

Upvotes: 1

ysrb
ysrb

Reputation: 6740

In your case I would probably use XML or Json document. Simpler and easier to maintain.

Upvotes: 0

Related Questions