Utilization of DB Cache

Mixing ADO with the ProudNet DB cache system

The DB cache system and ADO Wrapper API can be used interchangeably. However, when users directly handle tables that are exclusively accessed by the DB Cache Server and Client, the following must be taken care of.

Reading tables

The data cached in Proud.CDbCacheServer2 may not have been flushed to the DBMS yet, so the data information you get may be older than the actual state. Writing tables Proud.CDbCacheServer2 writes to these tables intermittently, so if you write something to them, it might overwrite the data that Proud.CDbCacheServer2 writes to them. Therefore, it is not recommended to write to these tables.

Adjusting DB cache disposition

Shortening the interval between writing cached DB information to the DBMS reduces the risk of losing unsaved data due to an abnormal shutdown of the DB cache server at the expense of DBMS performance.

The related method is Proud.CDbCacheServer2.SetDbmsWriteIntervalMs.

When the data is used and unloaded by the DB cache client, the gamer information remains in the DB cache server's memory, and after a period of time, it is also destroyed in the DB cache server's memory.

If you make this time period shorter, the memory used by the DB cache server will increase, but the load on the DBMS will be less because the DBMS will fetch data less often.

The related method is Proud.CDbCacheServer2.SetUnloadedDataHibernateDurationMs.

Loading a partial DB cache

It is possible that only one of a gamer's characters needs to be loaded. Partial loading is possible using the features of the ProudNet DB cache system.

Examples * RootTable is the Gamer, CharacterInfo table. * ChildTable is a Hero under Gamer, and an Item under CharacterInfo. * At least one user-defined field in Hero points to one field in CharacterInfo.

Using the methods for loading proprietary data and adding new data, you can load Gamer and CharacterInfo based on the character the user selects.

Below is the approximate code.

Proud::Guid outSessionGuid;
Proud::CDbCacheClient2* c = ...;
c->RequestExclusiveLoadData(L"Gamer",L"GamerID",gamername,outSessionGuid);
//This request receives the loadedGamerData.
 
...//Find the character the user picked in loadedGamerData.
 
c->RequestExclusiveLoadData(L"CharacterInfo",L"HeroIndex",findCharacter->heroIndex,outSessionGuid); 
//Load an info tree for the character the user selected.

Migrating from DB cache ver.1

In DB cache ver 1,

  • It covers the Gamer, Hero, and WorldObject tables, and requires you to specify the OwnerUUID, RootUUID, and ParentUUID to move them.

  • It deals with CLoadedHeroData, CLoadedItemData, and CLoadedGamerData, which should be dealing with CLoadedData instead.

Last updated