turbobytes / geoipdb

GeoIP related related helper functions for TurboBytes stack
MIT License
0 stars 2 forks source link

Cache LookupAsn results #14

Closed coolparadox closed 7 years ago

coolparadox commented 7 years ago

There is little chance that LookupAsn results change for the same inputs in a reasonable amount of time (say, daily).

Some sort of caching of returned information, valid for this period, would benefit the system, as it would reduce access to external services when same inputs are given.

There must be API endpoints for manually clearing the cache when users require it.

sajal commented 7 years ago

+1

Perhaps use some caching mechanism with 1 day TTL. And API to invalidate all cache(or specific keys) on demand.

coolparadox commented 7 years ago

LookupAsn() automaticaly retrieves cached data with 1 day TTL. If cached data is not found or expired, data is retrieved from other sources, as previously implemented, and cache is updated.

OverridesSet() and OverridesRemove() automatically purge the cache of all data related to the given ASN. This automatically handles asndb operation.

A new exported method PurgeAsnCache() is also available.