DB Cache usage and application

How to load proprietary data and add new data

The proprietary load method is Proud.CDbCacheClient2.RequestExclusiveLoadData. To search for data to load, you must enter search conditions in the arguments fieldName and cmpValue.

This is a usage example.

Proud::Guid outSessetionGuid;
Proud::CDbCacheClient2* c = ...;
c->RequestExclusiveLoadData(L"Gamer",L"GamerID",gamername,outSessetionGuid);

The Proud.CDbCacheClient2.RequestExclusiveLoadNewData method is similarly a proprietary load function, but it is used when you add data to RootTable and write it right away.

This is a usage example.

CPropNodePtr newNode = CPropNodePtr(new CPropNode(L"Gamer"));
 
newNode->Fields[L"GamerID"] = "Ulelio";
 
Proud::Guid outSessetionGuid;
Proud::CDbCacheClient2* c = ...;
c->RequestExclusiveLoadNewData(L"Gamer", newNode, outSessetionGuid);

Making unilateral data changes

  • Proud.CDbCacheClient2.UnilateralAddData

  • Proud.CDbCacheClient2.UnilateralUpdateData

  • Proud.CDbCacheClient2.UnilateralRemoveData

These methods return immediately upon call because they reflect the change in DB cache memory and later do the actual writing to the DBMS asynchronously. They also have no response method callbacks.

Use of request-responsive and blocked methods that are reflected in DBMS first

Using request-responsive methods and blocked methods, which are reflected in the DBMS first, are methods for request-responsive data changes. Returns immediately upon call, and changes are only reflected in the DB cache's memory after they have been written to the actual DBMS.

If you want a blocked call rather than a request-responsive one, use these methods.

  • Proud.CDbCacheClient2.BlockedAddData

  • Proud.CDbCacheClient2.BlockedUpdateData

  • Proud.CDbCacheClient2.BlockedRemoveData

Request-responsive SessionGuid

The proprietary clients will have one session each, and the DB Cache client will use a Guid value to distinguish between them. When requesting, the SessionGuid value is issued as an Output parameter, and the value issued as CCallbackArgs::m_sessionGuid of the response Event is received. You can check the requested session by saving and comparing outSessionGuid.

Request

CDbCacheClient2::RequestExclusiveLoadNewData(String rootTableName, CPropNodePtr addData, Guid &outSessionGuid);

Response

IDbCacheClientDelegate2::OnExclusiveLoadDataFailed(CCallbackArgs args)

The outSessionGuid of the request is the same as the args.m_sessionGuid of the response.

Non-proprietary data access methods

You must set Proud.CDbCacheServer2StartParameter.m_allowNonExclusiveAccess to allow non-proprietary access.

When a non-proprietary data change is successful, the change is reported to the DB cache client that was loading the data exclusively. The following methods are called for reporting.

  • Proud.IDbCacheClientDelegate2.OnSomeoneAddData

  • Proud.IDbCacheClientDelegate2.OnSomeoneRemoveData

  • Proud.IDbCacheClientDelegate2.OnSomeoneModifyValue

  • Proud.IDbCacheClientDelegate2.OnSomeoneSetValue

To make it easier to view, each request and response relationship is grouped together as follows.

Proud.CDbCacheClient2.RequestNonExclusiveSnapshotData : Get a snapshot

// Response:
IDbCacheClientDelegate2::OnNonExclusiveSnapshotDataSuccess (CCallbackArgs args)
IDbCacheClientDelegate2::OnNonExclusiveSnapshotDataFailed (CCallbackArgs args)

Proud.CDbCacheClient2.RequestNonExclusiveAddData : Add data

// Response:
IDbCacheClientDelegate2::OnNonExclusiveAddDataAck (CCallbackArgs args)
// Callback Event of proprietary DB Cache Client:
IDbCacheClientDelegate2::OnSomeoneAddData(CCallbackArgs& args)

Proud.CDbCacheClient2.RequestNonExclusiveRemoveData : Remove data

// Response:
IDbCacheClientDelegate2::OnNonExclusiveRemoveDataAck (CCallbackArgs args)
// Callback Event of proprietary DB Cache Client:
IDbCacheClientDelegate2::OnSomeoneRemoveData (CCallbackArgs& args)

Proud.CDbCacheClient2.RequestNonExclusiveModifyValue : Perform specific operations on data.(+, -, *, /)

// Response:
IDbCacheClientDelegate2::OnNonExclusiveModifyValueSuccess (CCallbackArgs args)
IDbCacheClientDelegate2::OnNonExclusiveModifyValueFailed (CCallbackArgs args)
// Callback Event of proprietary DB Cache Client:
IDbCacheClientDelegate2::OnSomeoneModifyValue (CCallbackArgs& args)

Proud.CDbCacheClient2.RequestNonExclusiveSetValueIf : Request to compare and store two values.

// Response:
IDbCacheClientDelegate2::OnNonExclusiveSetValueIfSuccess (CCallbackArgs args)
IDbCacheClientDelegate2::OnNonExclusiveSetValueIfFailed (CCallbackArgs args)
 
// Callback Event of proprietary DB Cache Client:
IDbCacheClientDelegate2::OnSomeoneSetValue (CCallbackArgs& args)

Precautions for using DB cache

This is a precaution when mixing unilateral type and request-response type (proprietary data request-response type & Block type & non-proprietary data access).

  • Using a unilateral method while a request-response method is in use can cause Proud.IDbCacheClientDelegate2.OnAccessError to be called.

  • If you use a unilateral method without getting a response for the data you changed, you may end up with the wrong data.


Usage

Last updated