C# Class Rock.Web.Cache.RockMemoryCache

Custom implementation of MemoryCache https://github.com/ironyx/sharpmemorycache
Inheritance: System.Runtime.Caching.MemoryCache
Afficher le fichier Open project: NewSpring/Rock Class Usage Examples

Méthodes publiques

Méthode Description
AddOrGetExisting ( string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName = null ) : object

Inserts a cache entry into the cache using the specified key and value and the specified details for how it is to be evicted.

AddOrGetExisting ( string key, object value, DateTimeOffset absoluteExpiration, string regionName = null ) : object

Adds a cache entry into the cache using the specified key and a value and an absolute expiration value.

Clear ( ) : void

Clears all items from cache.

Dispose ( ) : void

Releases unmanaged and - optionally - managed resources.

Get ( string key, string regionName = null ) : object

Returns an entry from the cache.

Remove ( string key, string regionName = null ) : object

Removes the specified key.

SendRedisCommand ( string command ) : void

Sends the redis command.

this ( string key ) : object

Gets or sets a value in the cache by using the default indexer property for an instance of the T:System.Runtime.Caching.MemoryCache class.

Private Methods

Méthode Description
FlushMemoryCache ( ) : void

Flushes the memory cache.

ProcessRedisCacheInstruction ( RedisChannel channel, RedisValue message ) : void
RemoveFromMemoryCache ( string key, string regionName = null ) : object

Removes from memory cache.

RockMemoryCache ( ) : System

Initializes the RockMemoryCache class.

RockMemoryCache ( string name, NameValueCollection config = null ) : System

Initializes a new instance of the RockMemoryCache class.

SetMemoryCacheLastTrimGen2Count ( object state ) : void

Sets the MemoryCache._stats._lastTrimGen2Count field to a value.

UpdateCacheHitMiss ( string key, bool hit ) : void

Updates the cache hit miss.

_redisConnection_ConnectionFailed ( object sender, StackExchange.Redis.ConnectionFailedEventArgs e ) : void
_redisConnection_ConnectionRestored ( object sender, StackExchange.Redis.ConnectionFailedEventArgs e ) : void

Method Details

AddOrGetExisting() public méthode

Inserts a cache entry into the cache using the specified key and value and the specified details for how it is to be evicted.
public AddOrGetExisting ( string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName = null ) : object
key string A unique identifier for the cache entry to add or get.
value object The data for the cache entry.
policy System.Runtime.Caching.CacheItemPolicy An object that contains eviction details for the cache entry. This object provides more options for eviction than a simple absolute expiration.
regionName string A named region in the cache to which a cache entry can be added. Do not pass a value for this parameter. By default, this parameter is null, because the class does not implement regions.
Résultat object

AddOrGetExisting() public méthode

Adds a cache entry into the cache using the specified key and a value and an absolute expiration value.
public AddOrGetExisting ( string key, object value, DateTimeOffset absoluteExpiration, string regionName = null ) : object
key string A unique identifier for the cache entry to add.
value object The data for the cache entry.
absoluteExpiration DateTimeOffset The fixed date and time at which the cache entry will expire.
regionName string A named region in the cache to which a cache entry can be added. Do not pass a value for this parameter. This parameter is null by default, because the class does not implement regions.
Résultat object

Clear() public static méthode

Clears all items from cache.
public static Clear ( ) : void
Résultat void

Dispose() public méthode

Releases unmanaged and - optionally - managed resources.
public Dispose ( ) : void
Résultat void

Get() public méthode

Returns an entry from the cache.
public Get ( string key, string regionName = null ) : object
key string A unique identifier for the cache entry to get.
regionName string A named region in the cache to which a cache entry was added. Do not pass a value for this parameter. This parameter is null by default, because the class does not implement regions.
Résultat object

Remove() public méthode

Removes the specified key.
public Remove ( string key, string regionName = null ) : object
key string The key.
regionName string Name of the region.
Résultat object

SendRedisCommand() public méthode

Sends the redis command.
public SendRedisCommand ( string command ) : void
command string The command.
Résultat void

this() public méthode

Gets or sets a value in the cache by using the default indexer property for an instance of the T:System.Runtime.Caching.MemoryCache class.
public this ( string key ) : object
key string The key.
Résultat object