Interface IResourceStoreManager.IVersionedResourceStoreBase<Key,​Value>

    • Method Detail

      • computeIfAbsent

        Value computeIfAbsent​(Key key,
                              Object version,
                              ISerializableThrowingFunction<? super Key,​? extends Value> loader)
                       throws IOException
        Gets the value associated with the given key. If no value exists yet, or if it exists but does not match the given value, it will be loaded using the given loader.
        Parameters:
        key - The key for which to get a value.
        version - The version of the key.
        loader - The loader to use if the value does not exist or is stale.
        Returns:
        The associated value, either from the store or obtained from the given loader.
        Throws:
        IOException - If the loader throws an exception.
      • getIfPresent

        Value getIfPresent​(Key key,
                           Object version)
        Gets the value associated with the given key. Returns null if no value exists yet. If the value exists, but is stale (i.e. does not match the version), it will be removed.
        Parameters:
        key - The key to get the value for.
        version - The version of the key.
        Returns:
        The associated value, if present and up-to-date, or null if no value exists or does not match the version.
      • remove

        void remove​(Key key)
        Removes the associated value form this store. Does nothing if no value exists yet.
        Parameters:
        key - The descriptor of the file to remove the derivative for.
      • removeAndGetIfPresent

        Value removeAndGetIfPresent​(Key key,
                                    Object version)
        Removes the value associated with the given key, if it matches the expected version. Returns null if no value exists yet. If the value exists, but is stale (i.e. does not match the version), it will be removed. The value returned by this method will NOT be closed if it implements AutoCloseable.
        Parameters:
        key - The key to get the value for.
        version - The version of the key.
        Returns:
        The associated value, if present and up-to-date, or null if no value exists or does not match the version.