Interface BasicCache<K,​V>

    • Method Detail

      • getName

        String getName()
        Retrieves the name of the cache
        Returns:
        the name of the cache
      • getVersion

        String getVersion()
        Retrieves the version of Infinispan
        Returns:
        a version string
      • put

        V put​(K key,
              V value)
        If the return value of this operation will be ignored by the application, the user is strongly encouraged to use the Flag.IGNORE_RETURN_VALUES flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).
        Specified by:
        put in interface Map<K,​V>
      • put

        V put​(K key,
              V value,
              long lifespan,
              TimeUnit unit)
        An overloaded form of put(Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • putIfAbsent

        V putIfAbsent​(K key,
                      V value,
                      long lifespan,
                      TimeUnit unit)
        An overloaded form of ConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • putAll

        void putAll​(Map<? extends K,​? extends V> map,
                    long lifespan,
                    TimeUnit unit)
        An overloaded form of Map.putAll(Map), which takes in lifespan parameters. Note that the lifespan is applied to all mappings in the map passed in.
        Parameters:
        map - map containing mappings to enter
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
      • replace

        V replace​(K key,
                  V value,
                  long lifespan,
                  TimeUnit unit)
        An overloaded form of ConcurrentMap.replace(Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • replace

        boolean replace​(K key,
                        V oldValue,
                        V value,
                        long lifespan,
                        TimeUnit unit)
        An overloaded form of ConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        oldValue - value to replace
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
        Returns:
        true if the value was replaced, false otherwise
      • put

        V put​(K key,
              V value,
              long lifespan,
              TimeUnit lifespanUnit,
              long maxIdleTime,
              TimeUnit maxIdleTimeUnit)
        An overloaded form of put(Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • putIfAbsent

        V putIfAbsent​(K key,
                      V value,
                      long lifespan,
                      TimeUnit lifespanUnit,
                      long maxIdleTime,
                      TimeUnit maxIdleTimeUnit)
        An overloaded form of ConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • putAll

        void putAll​(Map<? extends K,​? extends V> map,
                    long lifespan,
                    TimeUnit lifespanUnit,
                    long maxIdleTime,
                    TimeUnit maxIdleTimeUnit)
        An overloaded form of Map.putAll(Map), which takes in lifespan parameters. Note that the lifespan is applied to all mappings in the map passed in.
        Parameters:
        map - map containing mappings to enter
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
      • replace

        V replace​(K key,
                  V value,
                  long lifespan,
                  TimeUnit lifespanUnit,
                  long maxIdleTime,
                  TimeUnit maxIdleTimeUnit)
        An overloaded form of ConcurrentMap.replace(Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the value being replaced, or null if nothing is being replaced.
      • replace

        boolean replace​(K key,
                        V oldValue,
                        V value,
                        long lifespan,
                        TimeUnit lifespanUnit,
                        long maxIdleTime,
                        TimeUnit maxIdleTimeUnit)
        An overloaded form of ConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.
        Parameters:
        key - key to use
        oldValue - value to replace
        value - value to store
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        true if the value was replaced, false otherwise
      • merge

        V merge​(K key,
                V value,
                BiFunction<? super V,​? super V,​? extends V> remappingFunction,
                long lifespan,
                TimeUnit lifespanUnit)
        An overloaded form of ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - new value to merge with existing value
        remappingFunction - function to use to merge new and existing values into a merged value to store under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the merged value that was stored under key
      • merge

        V merge​(K key,
                V value,
                BiFunction<? super V,​? super V,​? extends V> remappingFunction,
                long lifespan,
                TimeUnit lifespanUnit,
                long maxIdleTime,
                TimeUnit maxIdleTimeUnit)
        An overloaded form of ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters.
        Parameters:
        key - key to use
        value - new value to merge with existing value
        remappingFunction - function to use to merge new and existing values into a merged value to store under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the merged value that was stored under key
      • compute

        V compute​(K key,
                  BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                  long lifespan,
                  TimeUnit lifespanUnit)
        An overloaded form of ConcurrentMap.compute(Object, BiFunction) which takes in lifespan parameters.
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the computed value that was stored under key
      • compute

        V compute​(K key,
                  BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                  long lifespan,
                  TimeUnit lifespanUnit,
                  long maxIdleTime,
                  TimeUnit maxIdleTimeUnit)
        An overloaded form of ConcurrentMap.compute(Object, BiFunction) which takes in lifespan and maxIdleTime parameters.
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the computed value that was stored under key
      • computeIfPresent

        V computeIfPresent​(K key,
                           BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                           long lifespan,
                           TimeUnit lifespanUnit)
        An overloaded form of ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan parameters.
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key, if such exists
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the computed value that was stored under key
      • computeIfPresent

        V computeIfPresent​(K key,
                           BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                           long lifespan,
                           TimeUnit lifespanUnit,
                           long maxIdleTime,
                           TimeUnit maxIdleTimeUnit)
        An overloaded form of ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan and maxIdleTime parameters.
        Parameters:
        key - key to use
        remappingFunction - function to use to compute and store the value under key, if such exists
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the computed value that was stored under key
      • computeIfAbsent

        V computeIfAbsent​(K key,
                          Function<? super K,​? extends V> mappingFunction,
                          long lifespan,
                          TimeUnit lifespanUnit)
        An overloaded form of ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan parameters.
        Parameters:
        key - key to use
        mappingFunction - function to use to compute and store the value under key, if the key is absent
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        Returns:
        the computed value that was stored under key
      • computeIfAbsent

        V computeIfAbsent​(K key,
                          Function<? super K,​? extends V> mappingFunction,
                          long lifespan,
                          TimeUnit lifespanUnit,
                          long maxIdleTime,
                          TimeUnit maxIdleTimeUnit)
        An overloaded form of ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan and maxIdleTime parameters.
        Parameters:
        key - key to use
        mappingFunction - function to use to compute and store the value under key, if the key is absent
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        Returns:
        the computed value that was stored under key
      • remove

        V remove​(Object key)
        If the return value of this operation will be ignored by the application, the user is strongly encouraged to use the Flag.IGNORE_RETURN_VALUES flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).
        Specified by:
        remove in interface Map<K,​V>