Skip to content
Andrey edited this page Dec 12, 2023 · 10 revisions

Main Concept.

MyNoSqlServer is a caching concept which makes possible to keep cached data locally at the microservices.

MyNoSqlServer has 4 main components:

How Data is kept.

Data is kept in DbRows. Each DbRow has reserved fields:

  • PartitionKey: String; - name of partition. Should be specified by the client.
  • RowKey: String; - name of row. Should be specified by the client.
  • Timestamp: String; - Timestamp of the moment DbRow is inserted (generated by the server). Format: YYYY-MM-DDThh:mm:ss.ms;
  • Expires: String - optional parameter. If it's not null - it must be formatted as YYYY-MM-DDThh:mm:ss.ms. If it's not null - record will be deleted after the Expires moment.

Example of the DbRow

{
  "PartitionKey": "Partition Id",
  "RowKey": "RowKeyValue",
  "Timestamp": "2020-01-02T12:00:15.123456",
  "Expires": "2020-01-02T12:00:17.123456",
  "CustomField1": 0.14,
  "CustomField2": "123",
  "CustomField3": [1, 2, 3]
}

Table and PartitionLey and RowKey;

To Identify the DbRow your developer have to specify:

  • TableName - which table is DbRow kept in;
  • PartitionKey - which DbPartition is DbRow kept in;
  • RowKey - Id of DbRow;

This way

  • if we specify TableName only - we get all the Rows of all partitions table;
  • if we specify TableName + PartitionKey - we get all the rows of the Partition;
  • if we specify TableName + PartitionKey + RowKey - we get the specific DbRow if it exists;

Max DbRows per partition and MaxPartitions per Table parameters;

Every moment we retrieve the Set of DbRows from MyNoSqlServer we can update the LastReadMoment of DbPartition and DbRows to the current one. As well - we can specify the maximum amount of DbRows can be held inside DbPartition; As well - we can specify the maximum amount of DbPartitions can be held inside Table;

MyNoSqlServer cleans the old records keeping the maximum amount of DbRows or DbPartition using the LastReadMoment property;

Every moment the developer inserts and updates the DbRow - LastReadMoment is updated to the current moment automatically;

Writers and Readers

When microservice architecture is being designed - the system usually is separated into the Microservices which Write DbRows and Which read DbRows to execute allocated user flows. The writer works in a quite classic way. We do HTTP request to execute CRUD Operations.

Readers on the other hand - are injected into microservices. They are Subscribed to tables and keep the local copy of table data inside the microservice.

Related Links:

Using Macros to describe MyNoSqlTableEntity: https://github.com/MyJetTools/my-no-sql-sdk/wiki/Macros