Udostępnij za pośrednictwem


ICacheService Interface

Definition

Provides access to a cache for arbitrary data associated with a file, project, solution or repo.

public interface class ICacheService
public interface ICacheService
type ICacheService = interface
Public Interface ICacheService

Remarks

Note that for sharing across machines, all keys and values with paths should be normalized, use forward slashes for path separators, and be relative to the path specified by GetRelativePathBaseAsync(CancellationToken).

The context that all cache access is associated with (e.g. solution, git repo/commit, etc.) is obtained when this service is activated and does not change automatically. Clients should dispose of the service and reactivate it after significant changes to context such as solution or folder open/close, or when a git repo's HEAD moves.

Methods

CheckExistsAsync(CacheItemKey, Boolean, CancellationToken)

Checks whether a value exists in the cache.

CheckExistsAsync(CacheItemKey, CancellationToken)

Checks whether a value exists in the cache.

DownloadContainerAsync(CacheContainerKey, IProgress<ProgressData>, CancellationToken)

Downloads all the container contents, if they are available in a remote cache.

GetRelativePathBaseAsync(CancellationToken)

Gets an absolute path that should be used as the basis for all relative paths stored in the cache for purposes of sharing across machines.

SetItemAsync(CacheItemKey, PipeReader, Boolean, CancellationToken)

Tries to add an item to cache and return a unique key. Stream will be read till end to determine content and size.

TryGetItemAsync(CacheItemKey, PipeWriter, Boolean, CancellationToken)

Tries to retrieve an item from cache that is assigned to a particular key.

TryGetItemAsync(CacheItemKey, PipeWriter, CancellationToken)

Tries to retrieve an item from cache that is assigned to a particular key.

Extension Methods

SetItemAsync(ICacheService, CacheItemKey, Stream, Boolean, CancellationToken)

Tries to add an item to cache and return a unique key. Stream will be read till end to determine content and size.

TryGetItemAsync(ICacheService, CacheItemKey, Boolean, CancellationToken)

Tries to retrieve an item from cache that is assigned to a particular key.

TryGetItemAsync(ICacheService, CacheItemKey, CancellationToken)

Tries to retrieve an item from cache that is assigned to a particular key.

Applies to