Class DnsCacheManipulator

    • Method Detail

      • setDnsCache

        public static void setDnsCache​(@Nonnull
                                       Properties properties)
        Set dns cache entries by properties.
        Parameters:
        properties - input properties.
        e.g. www.example.com=42.42.42.42,
        or value is multiply ips seperated by comma www.example.com=42.42.42.42,43.43.43.43
        Throws:
        DnsCacheManipulatorException - Operation fail
      • clearDnsCache

        public static void clearDnsCache()
        Clear whole dns cache entries(including cache and negative cache), cause lookup dns server for all host after.
        Throws:
        DnsCacheManipulatorException - Operation fail
      • getDnsCachePolicy

        public static int getDnsCachePolicy()
        Get JVM DNS cache policy.
        Returns:
        cache seconds.

        • -1 means never expired.(In effect, all negative value)
        • 0 never cached.
        Throws:
        DnsCacheManipulatorException - Operation fail
        Since:
        1.3.0
      • setDnsCachePolicy

        public static void setDnsCachePolicy​(int cacheSeconds)
        Set JVM DNS cache policy.

        NOTE: if Security Manage is turn on, JVM DNS cache policy set will not take effective. You can check by method getDnsCachePolicy().

        Parameters:
        cacheSeconds - set default dns cache time. Special input case:
        • -1 means never expired.(In effect, all negative value)
        • 0 never cached.
        Throws:
        DnsCacheManipulatorException - Operation fail
        Since:
        1.3.0
      • getDnsNegativeCachePolicy

        public static int getDnsNegativeCachePolicy()
        JVM DNS negative cache policy.
        Returns:
        negative cache seconds.

        • -1 means never expired.(In effect, all negative value)
        • 0 never cached.
        Throws:
        DnsCacheManipulatorException - Operation fail
        Since:
        1.3.0
      • setDnsNegativeCachePolicy

        public static void setDnsNegativeCachePolicy​(int negativeCacheSeconds)
        Set JVM DNS negative cache policy.
        Parameters:
        negativeCacheSeconds - set default dns cache time. Special input case:
        • -1 means never expired.(In effect, all negative value)
        • 0 never cached.
        Throws:
        DnsCacheManipulatorException - Operation fail
        Since:
        1.3.0