Class ResponseCacheImpl

  • All Implemented Interfaces:
    ResponseCache

    public class ResponseCacheImpl
    extends java.lang.Object
    implements ResponseCache
    The class that is responsible for caching registry information that will be queried by the clients.

    The cache is maintained in compressed and non-compressed form for three categories of requests - all applications, delta changes and for individual applications. The compressed form is probably the most efficient in terms of network traffic especially when querying all applications. The cache also maintains separate pay load for JSON and XML formats and for multiple versions too.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  ResponseCacheImpl.Value
      The class that stores payload in both compressed and uncompressed form.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ALL_APPS  
      static java.lang.String ALL_APPS_DELTA  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String get​(Key key)
      Get the cached information about applications.
      int getCurrentSize()
      Get the number of items in the response cache.
      byte[] getGZIP​(Key key)
      Get the compressed information about the applications.
      java.util.concurrent.atomic.AtomicLong getVersionDelta()
      Gets the version number of the cached data.
      static java.util.concurrent.atomic.AtomicLong getVersionDeltaStatic()
      Deprecated.
      use instance method getVersionDelta() Gets the version number of the cached data.
      java.util.concurrent.atomic.AtomicLong getVersionDeltaWithRegions()
      Gets the version number of the cached data with remote regions.
      static java.util.concurrent.atomic.AtomicLong getVersionDeltaWithRegionsLegacy()
      Deprecated.
      use instance method getVersionDeltaWithRegions() Gets the version number of the cached data with remote regions.
      void invalidate​(Key... keys)
      Invalidate the cache information given the list of keys.
      void invalidate​(java.lang.String appName, java.lang.String vipAddress, java.lang.String secureVipAddress)
      Invalidate the cache of a particular application.
      void stop()
      Performs a shutdown of this cache by stopping internal threads and unregistering Servo monitors.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

        public java.lang.String get​(Key key)
        Get the cached information about applications.

        If the cached information is not available it is generated on the first request. After the first request, the information is then updated periodically by a background thread.

        Specified by:
        get in interface ResponseCache
        Parameters:
        key - the key for which the cached information needs to be obtained.
        Returns:
        payload which contains information about the applications.
      • getGZIP

        public byte[] getGZIP​(Key key)
        Get the compressed information about the applications.
        Specified by:
        getGZIP in interface ResponseCache
        Parameters:
        key - the key for which the compressed cached information needs to be obtained.
        Returns:
        compressed payload which contains information about the applications.
      • stop

        public void stop()
        Description copied from interface: ResponseCache
        Performs a shutdown of this cache by stopping internal threads and unregistering Servo monitors.
        Specified by:
        stop in interface ResponseCache
      • invalidate

        public void invalidate​(java.lang.String appName,
                               @Nullable
                               java.lang.String vipAddress,
                               @Nullable
                               java.lang.String secureVipAddress)
        Invalidate the cache of a particular application.
        Specified by:
        invalidate in interface ResponseCache
        Parameters:
        appName - the application name of the application.
      • invalidate

        public void invalidate​(Key... keys)
        Invalidate the cache information given the list of keys.
        Parameters:
        keys - the list of keys for which the cache information needs to be invalidated.
      • getVersionDelta

        public java.util.concurrent.atomic.AtomicLong getVersionDelta()
        Gets the version number of the cached data.
        Specified by:
        getVersionDelta in interface ResponseCache
        Returns:
        teh version number of the cached data.
      • getVersionDeltaWithRegions

        public java.util.concurrent.atomic.AtomicLong getVersionDeltaWithRegions()
        Gets the version number of the cached data with remote regions.
        Specified by:
        getVersionDeltaWithRegions in interface ResponseCache
        Returns:
        teh version number of the cached data with remote regions.
      • getVersionDeltaStatic

        @Deprecated
        public static java.util.concurrent.atomic.AtomicLong getVersionDeltaStatic()
        Deprecated.
        use instance method getVersionDelta() Gets the version number of the cached data.
        Returns:
        teh version number of the cached data.
      • getVersionDeltaWithRegionsLegacy

        @Deprecated
        public static java.util.concurrent.atomic.AtomicLong getVersionDeltaWithRegionsLegacy()
        Deprecated.
        use instance method getVersionDeltaWithRegions() Gets the version number of the cached data with remote regions.
        Returns:
        teh version number of the cached data with remote regions.
      • getCurrentSize

        @Monitor(name="responseCacheSize",
                 type=GAUGE)
        public int getCurrentSize()
        Get the number of items in the response cache.
        Returns:
        int value representing the number of items in response cache.