Class GeolocationCache

java.lang.Object
com.djrapitops.plan.gathering.geolocation.GeolocationCache
All Implemented Interfaces:
SubSystem

@Singleton public class GeolocationCache extends Object implements SubSystem
This class contains the geolocation cache.

It caches all IPs with their matching country.

  • Constructor Details

  • Method Details

    • enable

      public void enable()
      Description copied from interface: SubSystem
      Performs enable actions for the subsystem.
      Specified by:
      enable in interface SubSystem
    • canGeolocate

      public boolean canGeolocate()
    • tryToPrepareGeoLite2

      public void tryToPrepareGeoLite2()
    • getCountry

      public String getCountry(String ipAddress)
      Retrieves the country in full length (e.g. United States) from the IP Address.
      Parameters:
      ipAddress - The IP Address for which the country is retrieved
      Returns:
      The name of the country in full length or null if the country could not be fetched.
    • disable

      public void disable()
      Description copied from interface: SubSystem
      Performs disable actions for the subsystem
      Specified by:
      disable in interface SubSystem
    • clearCache

      public void clearCache()
      Clears the cache