> For the complete documentation index, see [llms.txt](https://docs.proudnet.com/proudnet.eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.proudnet.com/proudnet.eng/proudnet/db_system/db_cache_ver2/network_setting.md).

# Install DB Cache and Set Up Network

## Game database schema for DB cache

The database schema for DB cache can be configured as desired by the user.&#x20;

However, the following rules must be followed.

> * The RootUUID, OwnerUUID, and UUID fields must be present.
> * When RootUUID, OwnerUUUID, and UUID are specified as <mark style="color:orange;">Combination PK</mark>, it adversely affects search using indexing. Therefore, creating and using each index helps improve performance.
> * Among the above fields, the RootUUID and OwnerUUID are designated as <mark style="color:orange;">Non-Unique Index</mark>, and the UUID is designated as Primary Key.
> * The above field must be in varchar(38) format in MySQL and <mark style="color:orange;">uniqueidentifier</mark> format in MSSQL.
> * The names of the Root table and Child table must not be duplicated.
> * The <mark style="color:orange;">stored procedure</mark> used by the DB cache client and server are automatically added to the game database schema; do not modify or remove them.

<figure><img src="/files/57JgrNm8073Fc8LOXwYR" alt=""><figcaption><p>Example of a database schema for storing gamer data in an MMORPG</p></figcaption></figure>

**Example script for adding 3 required indexes**

```sql
ALTER TABLE dbo.Gamer ADD CONSTRAINT
 
PK_Gamer PRIMARY KEY CLUSTERED
 
(
 
UUID
 
) WITH( IGNORE_DUP_KEY = OFF) ON [PRIMARY]
 
 
 
CREATE INDEX IX_Gamer_OwnerUUID ON dbo.Gamer
 
(
 
OwnerUUID
 
) WITH( IGNORE_DUP_KEY = OFF) ON [PRIMARY]
 
 
 
CREATE INDEX IX_Gamer_RootUUID ON dbo.Gamer
 
(
 
RootUUID
 
) WITH( IGNORE_DUP_KEY = OFF) ON [PRIMARY]
```

## Prepare the DB cache server

After creating the database schema, you need to create a DB cache server instance. Only one instance of type <mark style="color:orange;">Proud.CDbCacheServer2</mark> is sufficient between each game server.

<table><thead><tr><th width="305">Instance</th><th>Description</th></tr></thead><tbody><tr><td>Proud.CDbCacheServer2.New</td><td>Creating an instance</td></tr><tr><td>Proud.CDbCacheServer2.Start</td><td>Execution</td></tr></tbody></table>

> * The connection string to connect to the DB instance is in the form of an ADO connection string, which you can see in the sample.
> * The authentication key of the DB cache server is the data sent by the DB cache client to identify the connection on the DB cache server.
> * When calling <mark style="color:orange;">Proud.CDbCacheServer2.Start</mark>, <mark style="color:orange;">Proud.CDbCacheServer2StartParameter.m\_tableNames</mark> must contain the table names defined by the user.
> * While <mark style="color:orange;">Proud.CDbCacheServer2.Start</mark> is running, <mark style="color:orange;">sp\_Get\<tablename>Data</mark>, <mark style="color:orange;">sp\_Remove\<tablename>Data</mark>, and <mark style="color:orange;">sp\_Add\<tablename>Data</mark> are automatically created.

## Prepare the DB cache client

Each game server (authentication server, game zone server, lobby server, etc.) must run <mark style="color:orange;">Proud.CDbCacheClient2.New</mark> to create a client instance of type <mark style="color:orange;">Proud.CDbCacheClient2</mark>.

After creation, you must attempt to connect to the DB cache server via <mark style="color:orange;">Proud.CDbCacheClient2.Connect</mark>. The connection attempt is asynchronous and <mark style="color:orange;">Proud.IDbCacheClientDelegate2.OnJoinDbCacheServerComplete</mark> is called when the connection succeeds or fails.\
The DB cache client internally uses <mark style="color:orange;">Proud.CLanClient</mark>, but since it is a thread pooling method, there is no separate FrameMove.<br>

To disconnect from the DB cache server, destroy the <mark style="color:orange;">Proud.CDbCacheClient2</mark> object or call <mark style="color:orange;">Proud.CDbCacheClient2.Disconnect</mark>. At this time, the DB cache client calls <mark style="color:orange;">Proud.IDbCacheClientDelegate2.OnLeaveDbCacheServer</mark>.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.proudnet.com/proudnet.eng/proudnet/db_system/db_cache_ver2/network_setting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
