DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | List of all members
Deveel.Data.Caching.SizeLimitedCache Class Reference
Inheritance diagram for Deveel.Data.Caching.SizeLimitedCache:
Deveel.Data.Caching.MemoryCache Deveel.Data.Caching.Cache Deveel.Data.Caching.ICache

Public Member Functions

 SizeLimitedCache (int maxSize)
 
- Public Member Functions inherited from Deveel.Data.Caching.MemoryCache
 MemoryCache ()
 
override void Clear ()
 Clear the cache of all the entries. More...
 
- Public Member Functions inherited from Deveel.Data.Caching.Cache
bool Set (object key, object value)
 Puts an object into the cache with the given key. More...
 
bool TryGet (object key, out object value)
 Tries to get an object for the given key from the underlying cache system. More...
 
object Remove (Object key)
 Removes a node for the given key from the cache. More...
 
void Dispose ()
 
- Public Member Functions inherited from Deveel.Data.Caching.ICache
object Remove (object key)
 Removes an object from the cache. More...
 

Protected Member Functions

override void CheckClean ()
 This is called whenever at object is put into the cache. More...
 
override void UpdateElementAccess (object key, CacheValue cacheValue)
 
- Protected Member Functions inherited from Deveel.Data.Caching.MemoryCache
virtual CacheValue GetCacheValueUnlocked (object key)
 
virtual CacheValue SetValueUnlocked (object key, object value)
 
object RemoveUnlocked (object key)
 
override bool SetObject (object key, object value)
 When overridden in a derived class, it sets the value for the key given. More...
 
override bool TryGetObject (object key, out object value)
 
override object RemoveObject (object key)
 
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from Deveel.Data.Caching.Cache
 Cache ()
 
virtual bool WipeMoreNodes ()
 Checks if the clean-up method should clean up more elements from the cache. More...
 
virtual void OnWipingNode (object value)
 Notifies that the given object has been wiped from the cache by the clean up procedure. More...
 
virtual void OnObjectAdded (object key, object value)
 Notifies that the given object and key has been added to the cache. More...
 
virtual void OnObjectRemoved (object key, Object value)
 Notifies that the given object and key has been removed from the cache. More...
 
virtual void OnAllCleared ()
 Notifies that the cache has been entirely cleared of all elements. More...
 
virtual void OnGetWalks (long totalWalks, long totalGetOps)
 Notifies that some statistical information about the hash map has updated. More...
 
virtual int Clean ()
 Cleans away some old elements in the cache. More...
 

Properties

int MaxSize [get, private set]
 
- Properties inherited from Deveel.Data.Caching.MemoryCache
LinkedList< KeyValuePair< object, CacheValue > > IndexList [get, private set]
 
- Properties inherited from Deveel.Data.Caching.Cache
virtual int NodeCount [get]
 Gets the number of nodes that are currently being stored in the cache. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Deveel.Data.Caching.Cache
static int ClosestPrime (int value)
 

Detailed Description

Definition at line 20 of file SizeLimitedCache.cs.

Constructor & Destructor Documentation

Deveel.Data.Caching.SizeLimitedCache.SizeLimitedCache ( int  maxSize)
inline

Definition at line 21 of file SizeLimitedCache.cs.

21  {
22  MaxSize = maxSize;
23  }

Member Function Documentation

override void Deveel.Data.Caching.SizeLimitedCache.CheckClean ( )
inlineprotectedvirtual

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.

Reimplemented from Deveel.Data.Caching.Cache.

Definition at line 27 of file SizeLimitedCache.cs.

27  {
28  // If we have reached maximum cache size, remove some elements from the
29  // end of the list
30  if (NodeCount >= MaxSize) {
31  Clean();
32  }
33  }
virtual int Clean()
Cleans away some old elements in the cache.
Definition: Cache.cs:204
virtual int NodeCount
Gets the number of nodes that are currently being stored in the cache.
Definition: Cache.cs:125
override void Deveel.Data.Caching.SizeLimitedCache.UpdateElementAccess ( object  key,
CacheValue  cacheValue 
)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Caching.MemoryCache.

Definition at line 35 of file SizeLimitedCache.cs.

35  {
36  base.UpdateElementAccess(key, cacheValue);
37 
38  while (IndexList.Count > MaxSize) {
39  RemoveUnlocked(IndexList.Last.Value.Key);
40  }
41  }
object RemoveUnlocked(object key)
Definition: MemoryCache.cs:73
LinkedList< KeyValuePair< object, CacheValue > > IndexList
Definition: MemoryCache.cs:22

Property Documentation

int Deveel.Data.Caching.SizeLimitedCache.MaxSize
getprivate set

Definition at line 25 of file SizeLimitedCache.cs.


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