C# 클래스 Sage.CacheWrapper

Provides a wrapper around the current System.Web.Caching.Cache, as well as a plain key/value dictionary, so that if System.Web.Caching.Cache is null (as in unit test scenarios), the code using the cache can run without exceptions.
파일 보기 프로젝트 열기: igorfrance/sage

공개 메소드들

메소드 설명
CacheWrapper ( ) : System

Initializes a new instance of the CacheWrapper class.

CacheWrapper ( System.Web.HttpContextBase context ) : System

Initializes a new instance of the CacheWrapper class using the specified context.

Get ( string key ) : object

Retrieves the specified item from the cache.

Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies ) : void

Inserts an object into the cache that has file or key dependencies.

Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies, System.DateTime absoluteExpiration, System.TimeSpan slidingExpiration ) : void

Inserts an object into the cache with dependencies and expiration policies.

Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies, System.DateTime absoluteExpiration, System.TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback callback ) : void

Inserts an object into the cache with dependencies, expiration and priority policies, and a delegate you can use to notify your application when the inserted item is removed from the Cache.

Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies, System.DateTime absoluteExpiration, System.TimeSpan slidingExpiration, CacheItemUpdateCallback callback ) : void

Inserts an object into the cache together with dependencies, expiration policies, and a delegate that you can use to notify the application before the item is removed from the cache.

Remove ( string key ) : object

Removes the specified item from the cache.

this ( string key ) : object

Gets or sets the cache item at the specified key.

비공개 메소드들

메소드 설명
InsertToDictionary ( string key, object value ) : void

메소드 상세

CacheWrapper() 공개 메소드

Initializes a new instance of the CacheWrapper class.
public CacheWrapper ( ) : System
리턴 System

CacheWrapper() 공개 메소드

Initializes a new instance of the CacheWrapper class using the specified context.
public CacheWrapper ( System.Web.HttpContextBase context ) : System
context System.Web.HttpContextBase The current HTTP context.
리턴 System

Get() 공개 메소드

Retrieves the specified item from the cache.
public Get ( string key ) : object
key string The identifier for the cache item to retrieve.
리턴 object

Insert() 공개 메소드

Inserts an object into the cache that has file or key dependencies.
public Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies ) : void
key string The cache key that is used to reference the object.
value object The object to insert into the cache.
dependencies System.Web.Caching.CacheDependency The file or cache key dependencies for the item. When any dependency changes, /// the object becomes invalid and is removed from the cache. If there are no dependencies, this parameter /// contains null.
리턴 void

Insert() 공개 메소드

Inserts an object into the cache with dependencies and expiration policies.
public Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies, System.DateTime absoluteExpiration, System.TimeSpan slidingExpiration ) : void
key string The cache key that is used to reference the object.
value object The object to insert into the cache.
dependencies System.Web.Caching.CacheDependency The file or cache key dependencies for the item. When any dependency changes, /// the object becomes invalid and is removed from the cache. If there are no dependencies, this parameter /// contains null.
absoluteExpiration System.DateTime The time at which the inserted object expires and is removed from the /// cache. To avoid possible issues with local time such as changes from standard time to daylight saving /// time, use instead of for this parameter value. /// If you are using absolute expiration, the slidingExpiration parameter must be set to /// .
slidingExpiration System.TimeSpan The interval between the time that the cached object was last accessed /// and the time at which that object expires. If this value is the equivalent of 20 minutes, the object /// will expire and be removed from the cache 20 minutes after it was last accessed. If you are using /// sliding expiration, the absoluteExpiration parameter must be set to .
리턴 void

Insert() 공개 메소드

Inserts an object into the cache with dependencies, expiration and priority policies, and a delegate you can use to notify your application when the inserted item is removed from the Cache.
public Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies, System.DateTime absoluteExpiration, System.TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback callback ) : void
key string The cache key that is used to reference the object.
value object The object to insert into the cache.
dependencies System.Web.Caching.CacheDependency The file or cache key dependencies for the item. When any dependency changes, /// the object becomes invalid and is removed from the cache. If there are no dependencies, this parameter /// contains null.
absoluteExpiration System.DateTime The time at which the inserted object expires and is removed from the /// cache. To avoid possible issues with local time such as changes from standard time to daylight saving /// time, use instead of for this parameter value. /// If you are using absolute expiration, the slidingExpiration parameter must be set to /// .
slidingExpiration System.TimeSpan The interval between the time that the cached object was last accessed /// and the time at which that object expires. If this value is the equivalent of 20 minutes, the object /// will expire and be removed from the cache 20 minutes after it was last accessed. If you are using /// sliding expiration, the absoluteExpiration parameter must be set to .
priority CacheItemPriority The cost of the object relative to other items stored in the cache, as expressed /// by the enumeration. This value is used by the cache when it evicts /// objects; objects with a lower cost are removed from the cache before objects with a higher cost.
callback CacheItemRemovedCallback A delegate that will be called before the object is removed from the cache. /// You can use this to update the cached item and ensure that it is not removed from the cache.
리턴 void

Insert() 공개 메소드

Inserts an object into the cache together with dependencies, expiration policies, and a delegate that you can use to notify the application before the item is removed from the cache.
public Insert ( string key, object value, System.Web.Caching.CacheDependency dependencies, System.DateTime absoluteExpiration, System.TimeSpan slidingExpiration, CacheItemUpdateCallback callback ) : void
key string The cache key that is used to reference the object.
value object The object to insert into the cache.
dependencies System.Web.Caching.CacheDependency The file or cache key dependencies for the item. When any dependency changes, /// the object becomes invalid and is removed from the cache. If there are no dependencies, this parameter /// contains null.
absoluteExpiration System.DateTime The time at which the inserted object expires and is removed from the /// cache. To avoid possible issues with local time such as changes from standard time to daylight saving /// time, use instead of for this parameter value. /// If you are using absolute expiration, the slidingExpiration parameter must be set to /// .
slidingExpiration System.TimeSpan The interval between the time that the cached object was last accessed /// and the time at which that object expires. If this value is the equivalent of 20 minutes, the object /// will expire and be removed from the cache 20 minutes after it was last accessed. If you are using /// sliding expiration, the absoluteExpiration parameter must be set to .
callback CacheItemUpdateCallback A delegate that will be called before the object is removed from the cache. /// You can use this to update the cached item and ensure that it is not removed from the cache.
리턴 void

Remove() 공개 메소드

Removes the specified item from the cache.
public Remove ( string key ) : object
key string An identifier for the cache item to remove.
리턴 object

this() 공개 메소드

Gets or sets the cache item at the specified key.
public this ( string key ) : object
key string The key of the item to get.
리턴 object