C# 클래스 Scalien.Sequence

Sequence is a class for atomically retrieving unique integer IDs using a key whose value stores the next ID as a piece of text. The first returned ID is 1.

ScalienDB is a key value store, so unique IDs have to be maintained in a separate key in a seperate table. For example:

people => 2500

In this case, the next sequence value returned would be 2500.

ScalienDB has a special ADD command which parses the value as a number and increments it by a user specified value. The Index class wraps this functionality, and increments the number by a user-defined gran (default 1000). This way, the server is contacted only every 1000th time the sequence is incremented, which is an important optimization since sending and waiting for commands to execute on the server is slow.

Note that if the client quits before using up all the sequence values retrieved by the last ADD command, those will not be passed out, and there will be a hole in the sequence.

Use Reset() to reset the sequence to 1. This sets:

key => 1

파일 보기 프로젝트 열기: scalien/scaliendb 1 사용 예제들

공개 메소드들

메소드 설명
Reset ( ) : void

Reset the sequence to 1. The next time GetNext is called, 1 will be returned.

This sets:

key => 1

Set ( ulong value ) : void

Set the sequence to a given value. The next time GetNext is called, value will be returned.

This sets:

key => value

비공개 메소드들

메소드 설명
Sequence ( Scalien.Client client, ulong tableID, byte key ) : System
Sequence ( Scalien.Client client, ulong tableID, string key ) : System
SetGranularity ( long gran ) : void

메소드 상세

Reset() 공개 메소드

Reset the sequence to 1. The next time GetNext is called, 1 will be returned.
This sets:

key => 1

public Reset ( ) : void
리턴 void

Set() 공개 메소드

Set the sequence to a given value. The next time GetNext is called, value will be returned.
This sets:

key => value

public Set ( ulong value ) : void
value ulong
리턴 void