net.sourceforge.jnlp.cache

## Class CacheLRUWrapper

- java.lang.Object
- - net.sourceforge.jnlp.cache.CacheLRUWrapper

-     public class CacheLRUWrapper
      extends java.lang.Object

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheLRUWrapper()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete 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` | `containsKey(java.lang.String key)`
    `boolean` | `containsValue(java.lang.String value)`
    `java.lang.String` | `generateKey(java.lang.String path)` Generate a key given the path to file.
    `InfrastructureFileDescriptor` | `getCacheDir()`
    `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.
    `InfrastructureFileDescriptor` | `getRecentlyUsedFile()`
    `java.lang.String` | `getValue(java.lang.String key)` Return the value of given key.
    `java.io.File` | `getWindowsShortcutList()`
    `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.
    `boolean` | `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.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CacheLRUWrapper

          public CacheLRUWrapper()

  - ### Method Detail

    - #### getInstance

          public static CacheLRUWrapper getInstance()

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

    - #### getCacheDir

          public InfrastructureFileDescriptor getCacheDir()

      Returns:
        the cacheDir

    - #### getWindowsShortcutList

          public java.io.File getWindowsShortcutList()

    - #### getRecentlyUsedFile

          public InfrastructureFileDescriptor getRecentlyUsedFile()

      Returns:
        the recentlyUsedFile

    - #### load

          public void load()

      Update map for keeping track of recently used items.

    - #### store

          public boolean store()

      Write file to disk.
      Returns:
        true if properties were successfully stored, false otherwise

    - #### 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` - key of property
      Returns:
        value of given key, null otherwise.

    - #### containsKey

          public boolean containsKey(java.lang.String key)

    - #### containsValue

          public boolean containsValue(java.lang.String value)

    - #### 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