Enum NoOpCache

    • Enum Constant Detail

      • INSTANCE

        public static final NoOpCache INSTANCE
    • Method Detail

      • values

        public static NoOpCache[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (NoOpCache c : NoOpCache.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static NoOpCache valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • put

        public void put​(String id,
                        Object value)
        Description copied from interface: Cache
        Adds or replaces a value in the cache.
        Specified by:
        put in interface Cache
        Parameters:
        id - The object id
        value - The value to cache
      • get

        public <T> T get​(String id,
                         Function<? super String,​T> mappingFunction)
        Description copied from interface: Cache
        Returns the value associated with the given id. If there is no association, the mapping function is used to calculate a value. This value will be stored in the cache.
        Specified by:
        get in interface Cache
        Type Parameters:
        T - the type of object to return from the cache
        Parameters:
        id - The object id
        mappingFunction - The function to compute a value if the cache is not in the cache
        Returns:
        The value associated with given id
      • getIfPresent

        public <T> T getIfPresent​(String id)
        Description copied from interface: Cache
        Returns the value associated with the given id if it exists in the cache. If there is no association, null is returned.
        Specified by:
        getIfPresent in interface Cache
        Type Parameters:
        T - the type of object to return from the cache
        Parameters:
        id - The object id
        Returns:
        The value associated with given id
      • invalidate

        public void invalidate​(String id)
        Description copied from interface: Cache
        Invalidates the cache entry mapped to given id.
        Specified by:
        invalidate in interface Cache
      • invalidateAll

        public void invalidateAll()
        Description copied from interface: Cache
        Invalidates all cache entries.
        Specified by:
        invalidateAll in interface Cache