net.sourceforge.jnlp.cache

## Enum CacheLRUWrapper

- java.lang.Object
- - java.lang.Enum<CacheLRUWrapper>
  - - net.sourceforge.jnlp.cache.CacheLRUWrapper

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CacheLRUWrapper>

      public enum CacheLRUWrapper
      extends java.lang.Enum<CacheLRUWrapper>

  This class helps maintain the ordering of most recently use items across multiple jvm instances.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `INSTANCE`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `CACHE_INDEX_FILE_NAME`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addEntry(java.lang.String key, java.lang.String path)` This adds a new entry to file.
    `boolean` | `contains(java.lang.String key)` Test if we the key provided is in use.
    `java.lang.String` | `generateKey(java.lang.String path)` Generate a key given the path to file.
    `static CacheLRUWrapper` | `getInstance()` Returns an instance of the policy.
    `java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>>` | `getLRUSortedEntries()` Return a copy of the keys available.
    `java.lang.String` | `getValue(java.lang.String key)` Return the value of given key.
    `void` | `load()` Update map for keeping track of recently used items.
    `void` | `lock()` Lock the file to have exclusive access.
    `boolean` | `removeEntry(java.lang.String key)` This removed an entry from our map.
    `void` | `store()` Write file to disk.
    `void` | `unlock()` Unlock the file.
    `boolean` | `updateEntry(java.lang.String oldKey)` This updates the given key to reflect it was recently accessed.
    `static CacheLRUWrapper` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static CacheLRUWrapper[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### INSTANCE

          public static final CacheLRUWrapper INSTANCE

  - ### Field Detail

    - #### CACHE_INDEX_FILE_NAME

          public static final java.lang.String CACHE_INDEX_FILE_NAME

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### values

          public static CacheLRUWrapper[] 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 (CacheLRUWrapper c : CacheLRUWrapper.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static CacheLRUWrapper valueOf(java.lang.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:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null

    - #### getInstance

          public static CacheLRUWrapper getInstance()

      Returns an instance of the policy.
      Returns:
        an instance of the policy

    - #### load

          public void load()

      Update map for keeping track of recently used items.

    - #### store

          public void store()

      Write file to disk.

    - #### addEntry

          public boolean addEntry(java.lang.String key,
                         java.lang.String path)

      This adds a new entry to file.
      Parameters:
        `key` - key we want path to be associated with.
        `path` - path to cache item.
      Returns:
        true if we successfully added to map, false otherwise.

    - #### removeEntry

          public boolean removeEntry(java.lang.String key)

      This removed an entry from our map.
      Parameters:
        `key` - key we want to remove.
      Returns:
        true if we successfully removed key from map, false otherwise.

    - #### updateEntry

          public boolean updateEntry(java.lang.String oldKey)

      This updates the given key to reflect it was recently accessed.
      Parameters:
        `oldKey` - Key we wish to update.
      Returns:
        true if we successfully updated value, false otherwise.

    - #### getLRUSortedEntries

          public java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getLRUSortedEntries()

      Return a copy of the keys available.
      Returns:
        List of Strings sorted by ascending order.

    - #### lock

          public void lock()

      Lock the file to have exclusive access.

    - #### unlock

          public void unlock()

      Unlock the file.

    - #### getValue

          public java.lang.String getValue(java.lang.String key)

      Return the value of given key.
      Parameters:
        `key` -
      Returns:
        value of given key, null otherwise.

    - #### contains

          public boolean contains(java.lang.String key)

      Test if we the key provided is in use.
      Parameters:
        `key` - key to be tested.
      Returns:
        true if the key is in use.

    - #### generateKey

          public java.lang.String generateKey(java.lang.String path)

      Generate a key given the path to file. May or may not generate the same key given same path.
      Parameters:
        `path` - Path to generate a key with.
      Returns:
        String representing the a key.

Submit a bug or feature