C# Class Deveel.Data.Caching.Cache

A base implementation of a cache of objects.
Inheritance: ICache
显示文件 Open project: deveel/deveeldb Class Usage Examples

Public Methods

Method Description
Clear ( ) : void

Clear the cache of all the entries.

Dispose ( ) : void

Gets the closest prime number to the one specified.

A list of primes ordered from lowest to highest.

Remove ( object key ) : object

Removes a node for the given key from the cache.

This is useful for ensuring the cache does not contain out-dated information.

Set ( object key, object value ) : bool

Puts an object into the cache with the given key.

TryGet ( object key, object &value ) : bool

Protected Methods

Method Description
Cache ( ) : System
CheckClean ( ) : void

This is called whenever at object is put into the cache.

This method should determine if the cache should be cleaned and call the clean method if appropriate.

Clean ( ) : int

Cleans away some old elements in the cache.

This method walks from the end, back wipe count elements putting each object on the recycle stack.

Dispose ( bool disposing ) : void
OnAllCleared ( ) : void

Notifies that the cache has been entirely cleared of all elements.

OnGetWalks ( long totalWalks, long totalGetOps ) : void

Notifies that some statistical information about the hash map has updated.

This should be used to compile statistical information about the number of walks a get operation takes to retreive an entry from the hash.

This method is called every 8192 gets.

OnObjectAdded ( object key, object value ) : void

Notifies that the given object and key has been added to the cache.

OnObjectRemoved ( object key, Object value ) : void

Notifies that the given object and key has been removed from the cache.

OnWipingNode ( object value ) : void

Notifies that the given object has been wiped from the cache by the clean up procedure.

RemoveObject ( object key ) : object
SetObject ( object key, object value ) : bool

When overridden in a derived class, it sets the value for the key given.

TryGetObject ( object key, object &value ) : bool
WipeMoreNodes ( ) : bool

Checks if the clean-up method should clean up more elements from the cache.

Method Details

Cache() protected method

protected Cache ( ) : System
return System

CheckClean() protected method

This is called whenever at object is put into the cache.
This method should determine if the cache should be cleaned and call the clean method if appropriate.
protected CheckClean ( ) : void
return void

Clean() protected method

Cleans away some old elements in the cache.
This method walks from the end, back wipe count elements putting each object on the recycle stack.
protected Clean ( ) : int
return int

Clear() public method

Clear the cache of all the entries.
public Clear ( ) : void
return void

Dispose() public method

Gets the closest prime number to the one specified. A list of primes ordered from lowest to highest.
public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

OnAllCleared() protected method

Notifies that the cache has been entirely cleared of all elements.
protected OnAllCleared ( ) : void
return void

OnGetWalks() protected method

Notifies that some statistical information about the hash map has updated.
This should be used to compile statistical information about the number of walks a get operation takes to retreive an entry from the hash.

This method is called every 8192 gets.

protected OnGetWalks ( long totalWalks, long totalGetOps ) : void
totalWalks long
totalGetOps long
return void

OnObjectAdded() protected method

Notifies that the given object and key has been added to the cache.
protected OnObjectAdded ( object key, object value ) : void
key object
value object
return void

OnObjectRemoved() protected method

Notifies that the given object and key has been removed from the cache.
protected OnObjectRemoved ( object key, Object value ) : void
key object
value Object
return void

OnWipingNode() protected method

Notifies that the given object has been wiped from the cache by the clean up procedure.
protected OnWipingNode ( object value ) : void
value object The node value being wiped.
return void

Remove() public method

Removes a node for the given key from the cache.
This is useful for ensuring the cache does not contain out-dated information.
public Remove ( object key ) : object
key object
return object

RemoveObject() protected abstract method

protected abstract RemoveObject ( object key ) : object
key object
return object

Set() public method

Puts an object into the cache with the given key.
public Set ( object key, object value ) : bool
key object The key used to store the object.
value object The object to add to the cache.
return bool

SetObject() protected abstract method

When overridden in a derived class, it sets the value for the key given.
protected abstract SetObject ( object key, object value ) : bool
key object The key corresponding to the value to set.
value object the value to set into the cache.
return bool

TryGet() public method

public TryGet ( object key, object &value ) : bool
key object
value object
return bool

TryGetObject() protected abstract method

protected abstract TryGetObject ( object key, object &value ) : bool
key object
value object
return bool

WipeMoreNodes() protected method

Checks if the clean-up method should clean up more elements from the cache.
protected WipeMoreNodes ( ) : bool
return bool