Interface RefCache

All Known Implementing Classes:
ChainedReceiveCommands, RepoRefCache

public interface RefCache
Simple short-lived cache of individual refs read from a repo.

Within a single request that is known to read a small bounded number of refs, this class can be used to ensure a consistent view of one ref, and avoid multiple system calls to read refs multiple times.

Note: Implementations of this class are only appropriate for short-term caching, and do not support invalidation. It is also not threadsafe.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this cache, releasing the references to any underlying resources.
    Optional<org.eclipse.jgit.lib.ObjectId>
    get(String refName)
    Get the possibly-cached value of a ref.
  • Method Details

    • get

      Optional<org.eclipse.jgit.lib.ObjectId> get(String refName) throws IOException
      Get the possibly-cached value of a ref.
      Parameters:
      refName - name of the ref.
      Returns:
      value of the ref; absent if the ref does not exist in the repo. Never null, and never present with a value of ObjectId.zeroId().
      Throws:
      IOException
    • close

      void close()
      Closes this cache, releasing the references to any underlying resources.