Skip to content
InternetData

Caching and cost

How long a InternetData answer stays good, what to cache and where, and when to move from per-request lookups to a database.

An address's answer rarely changes within an hour, so caching saves both your quota and the time of a request.

  • Cache by address, for about an hour. The framework packages already do, in memory, for an hour by default, and each library's page says how its own cache works and how to share one across servers.
  • Don't cache errors. A failed lookup tells you nothing about the address.
  • Skip what never needs a lookup: health checks, static files and your own servers. Private and reserved addresses are answered by the libraries without a request.
  • Look up where it matters. Sign-up, login and checkout usually need the answer; a page view of a public article usually does not.
  • Batch a list. POST /batch takes up to 1,000 addresses in one call on a paid plan (Batch).

When a database is cheaper

Past a few million distinct visitors a day, or where every lookup must answer in microseconds, download the databases and look addresses up on your own servers. API or database compares the two.