Share via


DataCache Class

 

The object that is used by cache-enabled applications for storing and retrieving objects from the cache. An instance of this object is referred to as the cache client.

Namespace:   Microsoft.ApplicationServer.Caching
Assembly:  Microsoft.ApplicationServer.Caching.Client (in Microsoft.ApplicationServer.Caching.Client.dll)

Inheritance Hierarchy

System.Object
  Microsoft.ApplicationServer.Caching.DataCache

Syntax

public sealed class DataCache
public ref class DataCache sealed 
[<Sealed>]
type DataCache = class end
Public NotInheritable Class DataCache

Constructors

Name Description
System_CAPS_pubmethod DataCache()

Creates a DataCache that accesses the "default" cache; uses settings in the "default" cache client configuration.

System_CAPS_pubmethod DataCache(String)

Creates a DataCache that accesses the specified cache name; uses settings in the "default" cache client configuration.

System_CAPS_pubmethod DataCache(String, String)

Creates a DataCache that accesses the specified cache name; uses settings in the named cache client configuration.

Properties

Name Description
System_CAPS_pubproperty Item[String]

Allows for the use of array notation to access cached objects.

System_CAPS_pubproperty Name

The name of the cache associated with the DataCache object.

Methods

Name Description
System_CAPS_pubmethod Add(String, Object)

Adds an object to the cache.

System_CAPS_pubmethod Add(String, Object, IEnumerable<DataCacheTag>)

Adds an object to the cache. This method enables associating tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Add(String, Object, IEnumerable<DataCacheTag>, String)

Adds an object to a region in the cache. This method enables association of tags with objects in the cache. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Add(String, Object, String)

Adds an object to a region in the cache. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Add(String, Object, TimeSpan)

Adds an object to the cache. This method provides the ability to specify when the object should be expired.

System_CAPS_pubmethod Add(String, Object, TimeSpan, IEnumerable<DataCacheTag>)

Adds an object to the cache. This method enables associating tags with the cached object and specifying when the object should be expired. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Add(String, Object, TimeSpan, IEnumerable<DataCacheTag>, String)

Adds an object to a region in the cache. This method enables associating tags with the cached object and specifying when the object should be expired. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Add(String, Object, TimeSpan, String)

Adds an object to a region in the cache. This method provides the ability to specify when the object should be expired. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod AddCacheLevelBulkCallback(DataCacheBulkNotificationCallback)

Adds a bulk cache notification callback for cache operations occurring on all regions and items. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod AddCacheLevelCallback(DataCacheOperations, DataCacheNotificationCallback)

Adds a cache notification callback for cache operations occurring on all regions and items. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod AddFailureNotificationCallback(DataCacheFailureNotificationCallback)

Adds a failure notification callback, for notifications indicating that a client has missed one or more cache notifications. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod AddItemLevelCallback(String, DataCacheOperations, DataCacheNotificationCallback)

Adds a cache notification callback for cache operations occurring on one specific item that is not stored in a region. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod AddItemLevelCallback(String, DataCacheOperations, DataCacheNotificationCallback, String)

Adds a cache notification callback for cache operations occurring on one specific item that is stored in region. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod AddRegionLevelCallback(String, DataCacheOperations, DataCacheNotificationCallback)

Adds a cache notification callback for cache operations occurring on one specific region. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Append(String, String)

Concatenates a string to a string object stored in the cache.

System_CAPS_pubmethod Append(String, String, String)

Concatenates a string to a string object stored in the cache in the specified region.

System_CAPS_pubmethod BulkGet(IEnumerable<String>)

Gets all of the objects associated with the specified keys across all system regions. This method does not search user-defined regions.

System_CAPS_pubmethod BulkGet(IEnumerable<String>, String)

Returns objects for the specified keys from the specified region of the cache. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Clear()

Removes all objects from the cache associated with the DataCache object.

System_CAPS_pubmethod ClearRegion(String)

Deletes all objects in the specified region. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod CreateRegion(String)

Creates a region. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Decrement(String, Int64, Int64)

Decrements a long value stored in the cache.

System_CAPS_pubmethod Decrement(String, Int64, Int64, String)

Decrements a long value stored in the cache in the specified region.

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod Get(String)

Gets an object from the cache using the specified key.

System_CAPS_pubmethod Get(String, DataCacheItemVersion)

Gets an object from the cache using the specified key. You may also provide the version to obtain a specific version of a key, if that version is still the most current in the cache.

System_CAPS_pubmethod Get(String, DataCacheItemVersion, String)

Gets an object from the specified region by using the specified key. You may also provide the version to obtain the specific version of a key, if that version is still the most current in the region. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Get(String, String)

Gets an object from the specified region by using the specified key. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetAndLock(String, TimeSpan, DataCacheLockHandle)

Locks the key if the key is present and it is not locked and returns the object corresponding to the key.

System_CAPS_pubmethod GetAndLock(String, TimeSpan, DataCacheLockHandle, Boolean)

Lock the key if key is present and it is not locked by any clients and returns the object corresponding to the key.

System_CAPS_pubmethod GetAndLock(String, TimeSpan, DataCacheLockHandle, String)

Locks the key if the key is present and is not locked and returns the object corresponding to the key. For objects stored in regions. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetAndLock(String, TimeSpan, DataCacheLockHandle, String, Boolean)

Lock the key if key is present and it is not locked by any clients and returns the object corresponding to the key. For objects stored in regions. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetCacheItem(String)

Gets a DataCacheItem object to retrieve all information associated with your cached object in the cluster.

System_CAPS_pubmethod GetCacheItem(String, String)

Gets a DataCacheItem object to retrieve all information associated with your cached object in the cluster. For objects stored in regions. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetIfNewer(String, DataCacheItemVersion)

Gets an object from the cache, but only if a newer version of the object resides in the cache.

System_CAPS_pubmethod GetIfNewer(String, DataCacheItemVersion, String)

Gets an object from the specified region, but only if a newer version of the object resides in the region. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetObjectsByAllTags(IEnumerable<DataCacheTag>, String)

Gets an enumerable list of all cached objects in the specified region that have all the same tags in common. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetObjectsByAnyTag(IEnumerable<DataCacheTag>, String)

Gets an enumerable list of all cached objects in the specified region that have any of the same tags in common. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetObjectsByTag(DataCacheTag, String)

Gets an enumerable list of all cached objects in the specified region that have the specified tag. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetObjectsInRegion(String)

Gets an enumerable list of all cached objects in the specified region. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetSystemRegionName(String)

Returns the system region name for the specified key. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetSystemRegions()

Used to determine the default regions for the cache. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod Increment(String, Int64, Int64)

Increments a long value stored in the cache.

System_CAPS_pubmethod Increment(String, Int64, Int64, String)

Increments a long value stored in the cache in the specified region.

System_CAPS_pubmethod Prepend(String, String)

Prepends a string to a string object stored in the cache.

System_CAPS_pubmethod Prepend(String, String, String)

Prepends a string to a string object stored in the cache in the specified region.

System_CAPS_pubmethod Put(String, Object)

Adds or replaces an object in the cache.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion)

Adds or replaces an object in the cache if it is at the specified version.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion, IEnumerable<DataCacheTag>)

Adds or replaces an object in the cache if it is at the specified version. Associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion, IEnumerable<DataCacheTag>, String)

Adds or replaces an object in the specified region if it is at the specified version. Associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion, String)

Adds or replaces an object in the specified region if it is at the specified version. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion, TimeSpan)

Adds or replaces an object in the cache if it is at the specified version. Specifies the timeout value of the cached object.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion, TimeSpan, IEnumerable<DataCacheTag>)

Adds or replaces an object in the cache if it is at the specified version. Specifies the timeout value and associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion, TimeSpan, IEnumerable<DataCacheTag>, String)

Adds or replaces an object in the specified region if it is at the specified version. Specifies the timeout value and associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, DataCacheItemVersion, TimeSpan, String)

Adds or replaces an object in the specified region if it is at the specified version. Specifies the timeout value of the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, IEnumerable<DataCacheTag>)

Adds or replaces an object in the cache. Associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, IEnumerable<DataCacheTag>, String)

Adds or replaces an object in the specified region. Associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, String)

Adds or replaces an object in the specified region. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, TimeSpan)

Adds or replaces an object in the cache. Specifies the timeout value of the cached object.

System_CAPS_pubmethod Put(String, Object, TimeSpan, IEnumerable<DataCacheTag>)

Adds or replaces an object in the cache. Specifies the timeout value and associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, TimeSpan, IEnumerable<DataCacheTag>, String)

Adds or replaces an object in the specified region. Specifies the timeout value and associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Put(String, Object, TimeSpan, String)

Adds or replaces an object in the specified region. Specifies the timeout value of the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle)

Replaces and unlocks an object in the cache.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle, IEnumerable<DataCacheTag>)

Replaces and unlocks an object in the cache. Associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle, IEnumerable<DataCacheTag>, String)

Replaces and unlocks an object in the specified region. Associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle, String)

Replaces and unlocks an object in the specified region. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle, TimeSpan)

Replaces and unlocks an object in the cache. Specifies the timeout value of the cached object.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle, TimeSpan, IEnumerable<DataCacheTag>)

Replaces and unlocks an object in the cache. Specifies the timeout value and associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle, TimeSpan, IEnumerable<DataCacheTag>, String)

Replaces and unlocks an object in the specified region. Specifies the timeout value and associates tags with the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod PutAndUnlock(String, Object, DataCacheLockHandle, TimeSpan, String)

Replaces and unlocks an object in the specified region. Specifies the timeout value of the cached object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Remove(String)

Removes an object from the cache.

System_CAPS_pubmethod Remove(String, DataCacheItemVersion)

Removes an object with a specific version from the cache.

System_CAPS_pubmethod Remove(String, DataCacheItemVersion, String)

Removes an object with a specific version from the cache in a region. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Remove(String, DataCacheLockHandle)

Removes an object from the cache with an associated lock handle.

System_CAPS_pubmethod Remove(String, DataCacheLockHandle, String)

Removes an object from the cache with an associated lock handle in a region. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Remove(String, String)

Removes an object from the cache in a region. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod RemoveCallback(DataCacheNotificationDescriptor)

Removes a cache notification callback. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod RemoveRegion(String)

Deletes a region. All cached objects inside the region are also removed. Not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod ResetObjectTimeout(String, TimeSpan)

Resets the object timeout value, defining how long objects reside in the cache before expiring. The value specified for the object overrides the default settings for the cache.

System_CAPS_pubmethod ResetObjectTimeout(String, TimeSpan, String)

Resets the object timeout value, defining how long objects reside in the region before expiring. The value specified for the object overrides the default settings for the cache.

System_CAPS_pubmethod ToString()

(Inherited from Object.)

System_CAPS_pubmethod Unlock(String, DataCacheLockHandle)

Releases objects locked in the cache. This method supports pessimistic concurrency by making sure that the appropriate DataCacheLockHandle is used for unlocking the object.

System_CAPS_pubmethod Unlock(String, DataCacheLockHandle, String)

Releases objects locked in the specified region. This method supports pessimistic concurrency by making sure that the appropriate DataCacheLockHandle is used for unlocking the object. This overload is not supported in Windows Azure Shared Caching.

System_CAPS_pubmethod Unlock(String, DataCacheLockHandle, TimeSpan)

Releases objects locked in the cache. This method supports pessimistic concurrency by making sure that the appropriate DataCacheLockHandle is used for unlocking the object. Specifies a new timeout value for the cached object.

System_CAPS_pubmethod Unlock(String, DataCacheLockHandle, TimeSpan, String)

Releases objects locked in the specified region. This method supports pessimistic concurrency by making sure that the appropriate DataCacheLockHandle is used for unlocking the object. Specifies a new timeout value for the cached object. This overload is not supported in Windows Azure Shared Caching.

Events

Name Description
System_CAPS_pubevent CacheOperationCompleted

This API supports the product infrastructure and is not intended to be used directly from your code. Internal.

System_CAPS_pubevent CacheOperationStarted

This API supports the product infrastructure and is not intended to be used directly from your code. Internal.

Remarks

There are multiple options for cache clients, which are specified in the application configuration settings.

Thread Safety

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

See Also

Microsoft.ApplicationServer.Caching Namespace

Return to top