java.lang.Object
com.netflix.spinnaker.clouddriver.kubernetes.caching.agent.KubernetesCacheData

public class KubernetesCacheData extends 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

  • Constructor Details

    • KubernetesCacheData

      public KubernetesCacheData()
  • Method Details

    • addItem

      public void addItem(Keys.CacheKey key, Map<String,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, 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 List<com.netflix.spinnaker.cats.cache.CacheData> toCacheData()
      Return a List of CacheData entries representing the current items in the cache.
    • toStratifiedCacheData

      public Map<String,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.