DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Deveel.Data.Caching.DataCellCache.DCCache Class Reference

An implementation of Cache. More...

Inheritance diagram for Deveel.Data.Caching.DataCellCache.DCCache:

Public Member Functions

 DCCache (DataCellCache cache, ICache systemCache, int cache_hash_size, int max_cache_size)
 
void SetCacheSize (int cache_size)
 Used to dynamically alter the size of the cache. More...
 

Protected Member Functions

override void CheckClean ()
 
override bool WipeMoreNodes ()
 
override void OnWipingNode (Object ob)
 
override void OnGetWalks (long totalWalks, long totalGetOps)
 

Private Attributes

readonly DataCellCache cache
 
int maxCacheSize
 The maximum size that the cache can grow to in bytes. More...
 

Detailed Description

An implementation of Cache.

Definition at line 278 of file DataCellCache.cs.

Constructor & Destructor Documentation

Deveel.Data.Caching.DataCellCache.DCCache.DCCache ( DataCellCache  cache,
ICache  systemCache,
int  cache_hash_size,
int  max_cache_size 
)
inline

Definition at line 286 of file DataCellCache.cs.

287  : base(systemCache, cache_hash_size) {
288  this.cache = cache;
289  maxCacheSize = max_cache_size;
290  }
int maxCacheSize
The maximum size that the cache can grow to in bytes.

Member Function Documentation

override void Deveel.Data.Caching.DataCellCache.DCCache.CheckClean ( )
inlineprotected

Definition at line 307 of file DataCellCache.cs.

307  {
309  // Update the current cache size (before we wiped).
310  cache.context.Stats.Set(StatsDefaultKeys.DataCellCacheCurrentSize, (int) cache.CurrentCacheSize);
311  Clean();
312 
313  // The number of times we've cleared away old data cell nodes.
314  cache.context.Stats.Increment(StatsDefaultKeys.DataCellCacheClean);
315  }
316  }
readonly SystemContext context
The TransactionSystem that this cache is from.
int maxCacheSize
The maximum size that the cache can grow to in bytes.
long CurrentCacheSize
Returns an estimation of the current cache size in bytes.
override void Deveel.Data.Caching.DataCellCache.DCCache.OnGetWalks ( long  totalWalks,
long  totalGetOps 
)
inlineprotected

Definition at line 330 of file DataCellCache.cs.

330  {
331  int avg = (int) ((totalWalks*1000000L)/totalGetOps);
332  cache.context.Stats.Set("DataCellCache.avg_hash_get_mul_1000000", avg);
333  cache.context.Stats.Set("DataCellCache.current_cache_size", (int) cache.CurrentCacheSize);
334  cache.context.Stats.Set("DataCellCache.current_node_count", NodeCount);
335  }
readonly SystemContext context
The TransactionSystem that this cache is from.
long CurrentCacheSize
Returns an estimation of the current cache size in bytes.
override void Deveel.Data.Caching.DataCellCache.DCCache.OnWipingNode ( Object  ob)
inlineprotected

Definition at line 322 of file DataCellCache.cs.

322  {
323  base.OnWipingNode(ob);
324 
325  // Update our memory indicator accordingly.
326  var cell = (DataObject)ob;
328  }
static int AmountMemory(DataObject cell)
Returns an approximation of the amount of memory taken by a given DataObject.
void ReduceCacheSize(long val)
Evaluate the cache size by the given amount.
void Deveel.Data.Caching.DataCellCache.DCCache.SetCacheSize ( int  cache_size)
inline

Used to dynamically alter the size of the cache.

Parameters
cache_size

May cause a cache clean if the size is over the limit.

Definition at line 300 of file DataCellCache.cs.

300  {
301  maxCacheSize = cache_size;
302  CheckClean();
303  }
int maxCacheSize
The maximum size that the cache can grow to in bytes.
override bool Deveel.Data.Caching.DataCellCache.DCCache.WipeMoreNodes ( )
inlineprotected

Definition at line 318 of file DataCellCache.cs.

318  {
319  return (cache.CurrentCacheSize >= (int) ((maxCacheSize*100L)/115L));
320  }
int maxCacheSize
The maximum size that the cache can grow to in bytes.
long CurrentCacheSize
Returns an estimation of the current cache size in bytes.

Member Data Documentation

readonly DataCellCache Deveel.Data.Caching.DataCellCache.DCCache.cache
private

Definition at line 279 of file DataCellCache.cs.

int Deveel.Data.Caching.DataCellCache.DCCache.maxCacheSize
private

The maximum size that the cache can grow to in bytes.

Definition at line 284 of file DataCellCache.cs.


The documentation for this class was generated from the following file: