Class JGitKeyCache

java.lang.Object
org.eclipse.jgit.transport.sshd.JGitKeyCache
All Implemented Interfaces:
KeyCache

public class JGitKeyCache extends Object implements KeyCache
A simple KeyCache. JGit uses one such cache in its SshdSessionFactory to avoid loading keys multiple times.
Since:
5.2
  • Field Details

  • Constructor Details

    • JGitKeyCache

      public JGitKeyCache()
  • Method Details

    • get

      public KeyPair get(Path path, Function<? super Path,? extends KeyPair> loader)
      Description copied from interface: KeyCache
      Obtains a KeyPair from the cache. Implementations must be thread-safe.
      Specified by:
      get in interface KeyCache
      Parameters:
      path - of the key
      loader - to load the key if it isn't present in the cache yet
      Returns:
      the KeyPair, or null if not present and could not be loaded
    • close

      public void close()
      Description copied from interface: KeyCache
      Removes all KeyPair from this cache and destroys their private keys. This cache instance must not be used anymore thereafter.
      Specified by:
      close in interface KeyCache