DeveelDB
20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
|
Represents a cache for accesses to the the data cells within a Table. More...
Classes | |
class | DCCache |
An implementation of Cache. More... | |
struct | DCCacheKey |
Struct that creates an object that hashes nicely over the cache source. More... | |
Public Member Functions | |
void | AlterCacheDynamics (int maxCacheSize, int maxCellSize) |
Dynamically resizes the data cell cache so it can store more/less data. More... | |
void | Set (int tableKey, int row, int column, DataObject cell) |
Adds a DataObject on the cache for the given row/column of the table. More... | |
DataObject | Get (int tableKey, int row, int column) |
Gets a cell from the cache. More... | |
DataObject | Remove (int tableKey, int row, int column) |
Removes a cell from the cache. More... | |
void | Clear () |
Completely wipe the cache of all entries. More... | |
Package Functions | |
DataCellCache (SystemContext context, ICache systemCache, int maxCacheSize, int maxCellSize, int hashSize) | |
Instantiate the DataCellCache. More... | |
DataCellCache (SystemContext context, ICache systemCache, int maxCacheSize, int maxCellSize) | |
Static Package Functions | |
static int | ClosestPrime (int value) |
Returns a prime number from PRIME_LIST that is the closest prime greater or equal to the given value. More... | |
Properties | |
long | CurrentCacheSize [get] |
Returns an estimation of the current cache size in bytes. More... | |
Private Member Functions | |
void | ReduceCacheSize (long val) |
Evaluate the cache size by the given amount. More... | |
Static Private Member Functions | |
static int | AmountMemory (DataObject cell) |
Returns an approximation of the amount of memory taken by a given DataObject. More... | |
Private Attributes | |
readonly DCCache | cache |
The master cache. More... | |
readonly SystemContext | context |
The TransactionSystem that this cache is from. More... | |
long | currentCacheSize |
The current size of the cache. More... | |
int | maxCellSize |
The maximum size of a DataCell that is allowed to go in the cache. More... | |
Static Private Attributes | |
static readonly int[] | PRIME_LIST |
A list of primes ordered from lowest to highest. More... | |
Represents a cache for accesses to the the data cells within a Table.
Whenever a column/row index to a cell is accessed, the cache is first checked. If the cell is not in the cache then it may go ahead and read the cell from the file.
Issue We may need to keep track of memory used. Since a String may use up much memory, we may need a cap on the maximum size the cache can grow to. For example, we wouldn't want to cache a large document. This could be handled at a higher level?
Definition at line 37 of file DataCellCache.cs.
|
inlinepackage |
Instantiate the DataCellCache.
<param name="context></param> <param name="systemCache"></param> <param name="maxCacheSize">The maximum size in bytes that the cache is allowed to grow to (eg. 4000000).
maxCellSize | The maximum size of an object that can be stored in the cache. |
hashSize | The number of elements in the hash (should be a prime number). |
Definition at line 109 of file DataCellCache.cs.
|
inlinepackage |
Definition at line 116 of file DataCellCache.cs.
|
inline |
Dynamically resizes the data cell cache so it can store more/less data.
maxCacheSize | |
maxCellSize |
This is used to change cache dynamics at runtime.
Definition at line 140 of file DataCellCache.cs.
|
inlinestaticprivate |
Returns an approximation of the amount of memory taken by a given DataObject.
cell |
Definition at line 153 of file DataCellCache.cs.
|
inline |
Completely wipe the cache of all entries.
Definition at line 234 of file DataCellCache.cs.
|
inlinestaticpackage |
Returns a prime number from PRIME_LIST that is the closest prime greater or equal to the given value.
value |
Definition at line 263 of file DataCellCache.cs.
|
inline |
Gets a cell from the cache.
tableKey | |
row | |
column |
Definition at line 201 of file DataCellCache.cs.
|
inlineprivate |
Evaluate the cache size by the given amount.
val |
Definition at line 251 of file DataCellCache.cs.
|
inline |
Removes a cell from the cache.
tableKey | |
row | |
column |
This is used when we need to notify the cache that an object has become outdated. This should be used when the cell has been removed or changed.
Definition at line 222 of file DataCellCache.cs.
|
inline |
Adds a DataObject on the cache for the given row/column of the table.
tableKey | |
row | |
column | |
cell |
Ignores any cells that are larger than the maximum size.
Definition at line 168 of file DataCellCache.cs.
|
private |
The master cache.
Definition at line 81 of file DataCellCache.cs.
|
private |
The TransactionSystem that this cache is from.
Definition at line 86 of file DataCellCache.cs.
|
private |
The current size of the cache.
Definition at line 91 of file DataCellCache.cs.
|
private |
The maximum size of a DataCell that is allowed to go in the cache.
Definition at line 96 of file DataCellCache.cs.
|
staticprivate |
A list of primes ordered from lowest to highest.
Definition at line 41 of file DataCellCache.cs.
|
get |
Returns an estimation of the current cache size in bytes.
Definition at line 124 of file DataCellCache.cs.