Class CacheImpl<T extends HasMetadata>

    • Method Detail

      • setItemStore

        public void setItemStore​(ItemStore<T> items)
      • put

        public T put​(T obj)
        Update the object.
        Parameters:
        obj - the object
        Returns:
        the old object
      • remove

        public T remove​(T obj)
        Delete the object.
        Parameters:
        obj - object
        Returns:
        the old object
      • get

        public T get​(T obj)
        Get object
        Specified by:
        get in interface Store<T extends HasMetadata>
        Parameters:
        obj - the object
        Returns:
        the object
      • list

        public List<T> list()
        List all objects in the cache.
        Specified by:
        list in interface Store<T extends HasMetadata>
        Returns:
        the list
      • getByKey

        public T getByKey​(String key)
        Gets get by key.
        Specified by:
        getByKey in interface Store<T extends HasMetadata>
        Parameters:
        key - specific key
        Returns:
        the get by key
      • index

        public List<T> index​(String indexName,
                             T obj)
        Get objects
        Specified by:
        index in interface Indexer<T extends HasMetadata>
        Parameters:
        indexName - specific indexing function
        obj - object
        Returns:
        the list
      • indexKeys

        public List<String> indexKeys​(String indexName,
                                      String indexKey)
        Index keys list
        Specified by:
        indexKeys in interface Indexer<T extends HasMetadata>
        Parameters:
        indexName - specific indexing function
        indexKey - specific index key
        Returns:
        the list
      • byIndex

        public List<T> byIndex​(String indexName,
                               String indexKey)
        By index list
        Specified by:
        byIndex in interface Indexer<T extends HasMetadata>
        Parameters:
        indexName - specific indexing function
        indexKey - specific index key
        Returns:
        the list
      • addIndexFunc

        public CacheImpl<T> addIndexFunc​(String indexName,
                                         Function<T,​List<String>> indexFunc)
        Add index func.
        Parameters:
        indexName - the index name
        indexFunc - the index func
      • metaNamespaceKeyFunc

        public static String metaNamespaceKeyFunc​(Object obj)
        It's is a convenient default KeyFunc which know show to make keys for API objects which implement HasMetadata interface. The key uses the format namespace/name unless namespace is empty, then it's just name
        Parameters:
        obj - specific object
        Returns:
        the key
      • metaNamespaceIndexFunc

        public static List<String> metaNamespaceIndexFunc​(Object obj)
        It is a default index function that indexes based on an object's namespace
        Parameters:
        obj - the specific object
        Returns:
        the indexed value
      • isFullState

        public boolean isFullState()
      • getLockObject

        public Object getLockObject()