Class KubernetesCacheData


  • public class KubernetesCacheData
    extends java.lang.Object
    A collection of CacheItem entries used when building up the items being cached by the Kubernetes caching agent. This class supports adding items as well as adding relationships between items.

    Once all cache items and relationships have been added, calling toCacheData() will return a Collection of CacheData entries that represent all added items and their relationships. The operations supported on the class guarantee that the resulting Collection<CacheData> has the following properties: (1) Each CacheData has a unique cache key, (2) all relationships between CacheData items are bidirectional

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItem​(Keys.CacheKey key, java.util.Map<java.lang.String,​java.lang.Object> attributes)
      Add an item to the cache with specified key and attributes.
      void addRelationship​(Keys.CacheKey a, Keys.CacheKey b)
      Add a bidirectional relationship between two keys.
      void addRelationships​(Keys.CacheKey a, java.util.Set<Keys.CacheKey> b)
      Add a bidirectional relationships between key a and each of the keys in the Set b.
      java.util.List<com.netflix.spinnaker.cats.cache.CacheData> toCacheData()
      Return a List of CacheData entries representing the current items in the cache.
      java.util.Map<java.lang.String,​java.util.Collection<com.netflix.spinnaker.cats.cache.CacheData>> toStratifiedCacheData()
      Return a List of CacheData entries representing the current items in the cache, grouped by the item's group.
      • Methods inherited from class java.lang.Object

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

      • KubernetesCacheData

        public KubernetesCacheData()
    • Method Detail

      • addItem

        public void addItem​(Keys.CacheKey key,
                            java.util.Map<java.lang.String,​java.lang.Object> attributes)
        Add an item to the cache with specified key and attributes. If there is already an item with the given key, the attributes are merged into the existing item's attributes (with the input attributes taking priority).
      • addRelationship

        public void addRelationship​(Keys.CacheKey a,
                                    Keys.CacheKey b)
        Add a bidirectional relationship between two keys. If either of the keys is not yet in the cache, an entry is created for that item with an empty map of attributes.
      • addRelationships

        public void addRelationships​(Keys.CacheKey a,
                                     java.util.Set<Keys.CacheKey> b)
        Add a bidirectional relationships between key a and each of the keys in the Set b. If any of the encountered keys is not in the cache, an entry is created for that item with an empty map of attributes
      • toCacheData

        public java.util.List<com.netflix.spinnaker.cats.cache.CacheData> toCacheData()
        Return a List of CacheData entries representing the current items in the cache.
      • toStratifiedCacheData

        public java.util.Map<java.lang.String,​java.util.Collection<com.netflix.spinnaker.cats.cache.CacheData>> toStratifiedCacheData()
        Return a List of CacheData entries representing the current items in the cache, grouped by the item's group.