By Chris Dodd

2013-08-26 20:29:30 8 Comments

I'm trying to use the MaxMind GeoIP database, and I notice that the C API provides a bunch of different cacheing modes as flags to the GeoIP_open initialization call.


these are flag bits, so you can provide any set of them, but there's no documentation as to what these flags mean or what they do, or (perhaps most important) how they interact.

The benchmarks page indicates that GEOIP_MEMORY_CACHE makes it faster while GEOIP_CHECK_CACHE makes it slower, but there's no indication as to why you would want to use (or not use) any of these flags.


@Prem 2013-08-26 20:38:46

Their github page describes the purpose of these caches.

GEOIP_STANDARD - Read database from file system. This uses the least memory.
GEOIP_MEMORY_CACHE - Load database into memory. Provides faster performance but uses more memory.
GEOIP_CHECK_CACHE - Check for updated database. If database has been updated, reload file handle and/or memory cache.
GEOIP_INDEX_CACHE - Cache only the the most frequently accessed index portion of the database, resulting in faster lookups than GEOIP_STANDARD, but less memory usage than GEOIP_MEMORY_CACHE. This is useful for larger databases such as GeoIP Organization and GeoIP City. Note: for GeoIP Country, Region and Netspeed databases, GEOIP_INDEX_CACHE is equivalent to GEOIP_MEMORY_CACHE.
GEOIP_MMAP_CACHE - Load database into mmap shared memory. MMAP is not available for 32bit Windows.

These options can be combined using bit operators. For example you can use both GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE by calling: GeoIP_open("/path/to/GeoIP.dat", GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE);

Click to know more information

Related Questions

Sponsored Content

0 Answered Questions

Magento Geoip error maxmind

1 Answered Questions

MaxMind GeoIP City State accuracy

  • 2018-05-03 20:54:13
  • Jeff
  • 294 View
  • 0 Score
  • 1 Answer
  • Tags:   geoip maxmind

0 Answered Questions

Maxmind GeoIP Not Working

1 Answered Questions

[SOLVED] using maxmind geoip in spark serialized

3 Answered Questions

[SOLVED] Maxmind Geoip city encoding issue

2 Answered Questions

[SOLVED] Using django GeoIP and MaxMind database

0 Answered Questions

Powerdns maxmind geoip

1 Answered Questions

[SOLVED] php maxmind geoip exception ip

  • 2013-07-20 18:36:28
  • Ajr Ajr
  • 656 View
  • 0 Score
  • 1 Answer
  • Tags:   php geoip maxmind

1 Answered Questions

[SOLVED] Maxmind geoip query in delphi

  • 2012-08-13 13:30:03
  • asg2012
  • 1279 View
  • 2 Score
  • 1 Answer
  • Tags:   delphi geoip

2 Answered Questions

[SOLVED] MaxMind GeoIP redirects everything?

  • 2012-07-29 15:56:29
  • user1561167
  • 463 View
  • 0 Score
  • 2 Answer
  • Tags:   php redirect geoip

Sponsored Content