OpenPetra
Free Administration Software for Non-Profits
|
Public Member Functions | |
TCacheableTablesManager (TDelegateSendClientTask ADelegateSendClientTask) | |
Constructor More... | |
String | AddCachedTable (DataTable ACacheableTable) |
Adds the passed in DataTable to the Cache. More... | |
String | AddCachedTable (String ACacheableTableName, DataTable ACacheableTable) |
Adds the passed in DataTable to the Cache. More... | |
DataTable | GetCachedDataTable (String ACacheableTableName, out System.Type AType) |
Returns a DataTable from the Cache. More... | |
String | GetCachedDataTableHash (String ACacheableTableName) |
Returns the Hash Code of a DataTable in the Cache. More... | |
Int32 | GetCachedDataTableSize (String ACacheableTableName) |
Returns the TableSize of a DataTable in the Cache. More... | |
System.Type | GetCachedDataTableType (String ACacheableTableName) |
Returns the System.Type of a DataTable in the Cache. More... | |
void | AddOrRefreshCachedTable (DataTable ACacheableTable, System.Int32 AClientID) |
Adds the passed in DataTable to the Cache. If it is already there, the DataTable in the Cache is replaced with the one that is passed in. More... | |
void | AddOrRefreshCachedTable (String ACacheableTableName, DataTable ACacheableTable, System.Int32 AClientID) |
Adds the passed in DataTable to the Cache. If it is already there, the DataTable in the Cache is replaced with the one that is passed in. More... | |
void | RefreshCachedTable (DataTable ACacheableTable, System.Int32 AClientID) |
Replaces a DataTable in the Cache with the one that is passed in. More... | |
void | RefreshCachedTable (String ACacheableTableName, DataTable ACacheableTable, System.Int32 AClientID) |
Replaces a DataTable in the Cache with the one that is passed in. More... | |
void | AddOrMergeCachedTable (DataTable ACacheableTable, System.Int32 AClientID) |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done. More... | |
void | AddOrMergeCachedTable (DataTable ACacheableTable, System.Int32 AClientID, object AFilterCriteria) |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done. More... | |
void | AddOrMergeCachedTable (String ACacheableTableName, DataTable ACacheableTable, System.Int32 AClientID) |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done. More... | |
void | AddOrMergeCachedTable (String ACacheableTableName, DataTable ACacheableTable, System.Int32 AClientID, object AFilterCriteria) |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done. More... | |
Boolean | IsTableCached (String ACacheableTableName) |
Returns true if the DataTable with the specified TableName is in the DataCache and does not need refreshing. More... | |
Boolean | IsTableCached (String ACacheableTableName, out Boolean AIsUpToDate) |
Returns true if the DataTable with the specified TableName is in the DataCache. If it returns true the AIsUpToDate parameter will indicate if the cached table is up-to-date. This method is required by the client-side manager only. More... | |
void | MarkCachedTableNeedsRefreshing (String ACacheableTableName) |
Marks a DataTable in the Cache to be no longer up-to-date (=out of sync with the data that was originally placed in the DataTable). More... | |
void | MarkAllCachedTableNeedsRefreshing () |
Marks all DataTables in the Cache to be no longer up-to-date (=out of sync with the data that was originally placed in the DataTable). More... | |
void | MarkChangedCacheTableSaved (String ACacheableTableName) |
Marks a DataTable as being saved to the external source of the data and having no changes to it. More... | |
Static Public Member Functions | |
static void | Init () |
Static Public Attributes | |
static TCacheableTablesManager | GCacheableTablesManager |
a static instance for this class More... | |
Properties | |
Int32 | CacheSize [get] |
Current size of the data in the Cache More... | |
Int32 | CachedTablesCount [get] |
Number of DataTables in the Cache More... | |
Int32 | MaxCacheSize [get, set] |
Maximum size that the Cache shouldn't exceed More... | |
TimeSpan | MaxTimeInCache [get, set] |
Maximum time that a DataTable in the Cache should be cached More... | |
Contains methods that allow managing a Cache that can contain arbitrary DataTables (typed and untyped DataTables).
This Class is an implementation of a Cache Manager. It gets used by both PetraServer and PetraClient to manage a Cache of DataTables (that would usually be lookup tables for ComboBoxes, etc.). When it is used by the PetraServer, it is instantiated only once in the main AppDomain of the PetraServer. Each time a Client requests a Cacheable DataTable from the PetraServer, a cross-AppDomain call from the Client's AppDomain to methods of the Object of this Class that is instantiated in the main AppDomain is made. When it is used by the PetraClient, it is instantiated only once by the TDataCache Class in Ict.Petra.Client.App.Core.Cache, which is the only Class that programmers need to use on the Client side.
@comment This class is thread save. It protects two resources, UDataCacheDataSet and UDataCacheContentsDT with the same ReaderWriterLock (not with a Monitor - for performance). The DataTables that are handed out of TCacheableTablesManager are copies of the DataTables in the Cache. This is done to get around multi-threading reading/writing issues that might occur when the caller performs read or write operations on the DataTable - which are out of control of this class.
@comment Several of the Methods are declared as 'virtual'. This is necessary for all Methods that are called cross-AppDomain. Explanation for this: mono can't cope with method calls into different AppDomains if these methods are not marked virtual (see answer of Lluis Sanchez for the filed bug #76752 in mono's bugzilla). Apparently, C# code automatically marks such methods virtual when it is JITted, but Delphi.NET code doesn't do this.
@TODO Test some cache management functions (enabled by setting Properties MaxCacheSize and MaxTimeInCache) - the implementation of adhering to these settings is probably not quite finished yet (due to time constraints).
|
inline |
Constructor
ADelegateSendClientTask | Delegate that is used for sending a ClientTask to all other Clients to tell them to reload a certain Cacheable DataTable |
|
inline |
Adds the passed in DataTable to the Cache.
ACacheableTable | DataTable that should be added to the Cache |
|
inline |
Adds the passed in DataTable to the Cache.
ACacheableTableName | Name of the DataTable. This is the name by which the DataTable will be identified in the Cache. Also, the TableName property of the DataTable is set to this |
ACacheableTable | DataTable that should be added to the Cache |
|
inline |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done.
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
|
inline |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done.
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
AFilterCriteria | Filter Criteria (eg. Ledger Number for the Finance Module) that will be needed by the Clients that receive the ClientTask to be able to request the update of the filtered Cached DataTable |
|
inline |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done.
ACacheableTableName | Name of the DataTable |
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
|
inline |
Adds the passed in DataTable to the Cache. If it is already there, a Merge operation is done.
ACacheableTableName | Name of the DataTable |
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
AFilterCriteria | Filter Criteria (eg. Ledger Number for the Finance Module) that will be needed by the Clients that receive the ClientTask to be able to request the update of the filtered Cached DataTable |
|
inline |
Adds the passed in DataTable to the Cache. If it is already there, the DataTable in the Cache is replaced with the one that is passed in.
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
|
inline |
Adds the passed in DataTable to the Cache. If it is already there, the DataTable in the Cache is replaced with the one that is passed in.
ACacheableTableName | DataTable that should be added to the Cache/merged |
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
|
inline |
Returns a DataTable from the Cache.
ACacheableTableName | Name of the DataTable |
AType |
ECacheableTablesMgrTableNotUpToDateException | if the Cacheable DataTable isn't in an up-to-date state. This means it needs to be retrieved anew before it can be used |
|
inline |
Returns the Hash Code of a DataTable in the Cache.
ACacheableTableName | Name of the DataTable |
ECacheableTablesMgrException | If the DataTable doesn't exist in the Cache (=has no entry in the 'Table of Contents' of the Cache) |
|
inline |
Returns the TableSize of a DataTable in the Cache.
ACacheableTableName | Name of the DataTable |
ECacheableTablesMgrException | if the DataTable doesn't exist in the Cache |
|
inline |
Returns the System.Type of a DataTable in the Cache.
ACacheableTableName | Name of the DataTable |
ECacheableTablesMgrException | if the DataTable doesn't exist in the Cache |
|
inlinestatic |
|
inline |
Returns true if the DataTable with the specified TableName is in the DataCache and does not need refreshing.
ACacheableTableName | Name of the DataTable |
|
inline |
Returns true if the DataTable with the specified TableName is in the DataCache. If it returns true the AIsUpToDate parameter will indicate if the cached table is up-to-date. This method is required by the client-side manager only.
ACacheableTableName | Name of the DataTable |
AIsUpToDate | Will be true if the table is in the cache and up-to-date. False otherwise |
|
inline |
Marks all DataTables in the Cache to be no longer up-to-date (=out of sync with the data that was originally placed in the DataTable).
This will lead to ECacheableTablesMgrTableNotUpToDateException being thrown when GetCachedDataTable is called for this DataTable. This tells the caller of GetCachedDataTable that the DataTable needs to be retrieved anew before it can be used.
ECacheableTablesMgrException | if the DataTable doesn't exist in the Cache |
|
inline |
Marks a DataTable in the Cache to be no longer up-to-date (=out of sync with the data that was originally placed in the DataTable).
This will lead to ECacheableTablesMgrTableNotUpToDateException being thrown when GetCachedDataTable is called for this DataTable. This tells the caller of GetCachedDataTable that the DataTable needs to be retrieved anew before it can be used.
ACacheableTableName | Name of the DataTable |
ECacheableTablesMgrException | if the DataTable doesn't exist in the Cache |
|
inline |
Marks a DataTable as being saved to the external source of the data and having no changes to it.
This will lead to ECacheableTablesMgrTableNotUpToDateException beeing thrown when GetCachedDataTable is called for this DataTable. This tells the caller of GetCachedDataTable that the DataTable needs to be retrieved anew before it can be used.
ACacheableTableName | Name of the DataTable |
ECacheableTablesMgrException | if the DataTable doesn't exist in the Cache |
|
inline |
Replaces a DataTable in the Cache with the one that is passed in.
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
|
inline |
Replaces a DataTable in the Cache with the one that is passed in.
ACacheableTableName | Name of the DataTable |
ACacheableTable | DataTable that should be added to the Cache/merged with an already existing DataTable in the Cache with the same TableName |
AClientID | The ClientID that should be exempt from getting a ClientTask queued for updating of the Cached DataTable (only if a Merge operation is done). This would be the ClientID of the Client that performed the call to this procedure |
|
static |
a static instance for this class
|
get |
Number of DataTables in the Cache
|
get |
Current size of the data in the Cache
|
getset |
Maximum size that the Cache shouldn't exceed
|
getset |
Maximum time that a DataTable in the Cache should be cached