A few months ago I tweeted about a new open source project Octokit.Caching but completely forgot do any more announcing.

What does it do?

It’s a compact library designed to add simple caching to Octokit.NET a GitHub API client library for .NET. It maintains an internal cache of all requests and responses to and from the GitHub API.

If you make a request where a cached response is already available then it appends the If-None-Match header with the cached etag.

If the server returns a 304 Not Modified then we return the cached response, otherwise we return the new response while modifying the cache.

Where’s the cache?

Octokit.Caching comes with an interface ICache and a default implementation NaiveInMemoryCache

public interface ICache
    Task<T> GetAsync<T>(string key);
    Task SetAsync<T>(string key, T value);

	Task ClearAsync();

It’s built for you to extend easily with something like Akavache.

Where can I get it?

The source is available on Github and is available on nuget.