TeamFoundationCacheService<TKey, TValue> Class

A base class that can be used to implement an in-memory cache service.

This class provides thread safe get/add methods, implements ITeamFoundationService and cleanup scheduling.

Derived class must implement a cleanup logic.

System.Object
  Microsoft.TeamFoundation.Framework.Server.TeamFoundationCacheService<TKey, TValue>

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)

[TeamFoundationServiceDependency(typeof(TeamFoundationTaskService))]
public abstract class TeamFoundationCacheService<TKey, TValue> : ITeamFoundationService

Type Parameters

TKey

TValue

The TeamFoundationCacheService<TKey, TValue> type exposes the following members.

  NameDescription
Protected methodTeamFoundationCacheService<TKey, TValue>Initializes a new instance of TeamFoundationCacheService class.
Top

  NameDescription
Public methodAddAdds an item to the cache. If an item with the specified key already occurs in the cached, then new item is not added to the dictionary and the method return an item that is already in a cache.
Public methodBulkRemoveRemoves items from the cache. This method is thread safe.
Public methodBulkSetAdds items to the cache. If item with specified key exists in the cache, it is replaced.
Public methodClearRemoves all items from the cache. This method is thread safe.
Protected methodDoCleanupThis method is called to cleanup the cache. Derived class must implement cleanup strategy. A lock is acquired before this method is called, which gurantees that derived class has an exclusive access to the cache dictionary. Values are tuples, where Item1 is a stop watch that is set on a last access to the item, and Item2 is an item itself.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValuesGets all values.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveRemoves an item from the cache. This method is thread safe.
Public methodSetAdds item to the cache. If item with specified key exists in the cache, it is replaced.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTryGetValueGets the value associated with the specified key.
Top

  NameDescription
Explicit interface implemetationPrivate methodITeamFoundationService.ServiceEndThis method is called when the service is stopped.
Explicit interface implemetationPrivate methodITeamFoundationService.ServiceStartStarts the service.
Top

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: