⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcutil.3

📁 高性能嵌入式数据库在高并发的环境下使用最好是64位系统比较好
💻 3
📖 第 1 页 / 共 5 页
字号:
.RE.RSThe return value is the new list object containing all values in the map object..RE.RSBecause the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use..RE.RE.PPThe function `tcmapvals2' is used in order to create an array of strings of all values in a map object..PP.RS.br\fBconst char **tcmapvals2(const TCMAP *\fImap\fB, int *\fInp\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fInp\fR' specifies the pointer to a variable into which the number of elements of the return value is assigned..RE.RSThe return value is the pointer to the array of all string values in the map object..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if when is no longer in use.  Note that elements of the array point to the inner objects, whose life duration is synchronous with the map object..RE.RE.PPThe function `tcmapaddint' is used in order to add an integer to a record in a map object..PP.RS.br\fBint tcmapaddint(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fInum\fR' specifies the additional value..RE.RSThe return value is the summation value..RE.RSIf the corresponding record exists, the value is treated as an integer and is added to.  If no record corresponds, a new record of the additional value is stored..RE.RE.PPThe function `tcmapadddouble' is used in order to add a real number to a record in a map object..PP.RS.br\fBdouble tcmapadddouble(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fInum\fR' specifies the additional value..RE.RSThe return value is the summation value..RE.RSIf the corresponding record exists, the value is treated as a real number and is added to.  If no record corresponds, a new record of the additional value is stored..RE.RE.PPThe function `tcmapclear' is used in order to clear a map object..PP.RS.br\fBvoid tcmapclear(TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSAll records are removed..RE.RE.PPThe function `tcmapcutfront' is used in order to remove front records of a map object..PP.RS.br\fBvoid tcmapcutfront(TCMAP *\fImap\fB, int \fInum\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fInum\fR' specifies the number of records to be removed..RE.RE.PPThe function `tcmapdump' is used in order to serialize a map object into a byte array..PP.RS.br\fBvoid *tcmapdump(const TCMAP *\fImap\fB, int *\fIsp\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSThe return value is the pointer to the region of the result serial region..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tcmapload' is used in order to create a map object from a serialized byte array..PP.RS.br\fBTCMAP *tcmapload(const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIptr\fR' specifies the pointer to the region of serialized byte array..RE.RS`\fIsize\fR' specifies the size of the region..RE.RSThe return value is a new map object..RE.RSBecause the object of the return value is created with the function `tcmapnew', it should be deleted with the function `tcmapdel' when it is no longer in use..RE.RE.PPThe function `tcmaploadone' is used in order to extract a map record from a serialized byte array..PP.RS.br\fBvoid *tcmaploadone(const void *\fIptr\fB, int \fIsize\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR.RS`\fIptr\fR' specifies the pointer to the region of serialized byte array..RE.RS`\fIsize\fR' specifies the size of the region..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the value of the corresponding record.  `NULL' is returned when no record corresponds..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string..RE.RE.SH API OF ON\-MEMORY HASH DATABASE.PPThe function `tcmdbnew' is used in order to create an on\-memory hash database object..PP.RS.br\fBTCMDB *tcmdbnew(void);\fR.RSThe return value is the new on\-memory hash database object..RE.RSThe object can be shared by plural threads because of the internal mutex..RE.RE.PPThe function `tcmdbnew2' is used in order to create an on\-memory hash database object with specifying the number of the buckets..PP.RS.br\fBTCMDB *tcmdbnew2(uint32_t \fIbnum\fB);\fR.RS`\fIbnum\fR' specifies the number of the buckets..RE.RSThe return value is the new on\-memory hash database object..RE.RSThe object can be shared by plural threads because of the internal mutex..RE.RE.PPThe function `tcmdbdel' is used in order to delete an on\-memory hash database object..PP.RS.br\fBvoid tcmdbdel(TCMDB *\fImdb\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RE.PPThe function `tcmdbput' is used in order to store a record into an on\-memory hash database object..PP.RS.br\fBvoid tcmdbput(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIvbuf\fR' specifies the pointer to the region of the value..RE.RS`\fIvsiz\fR' specifies the size of the region of the value..RE.RSIf a record with the same key exists in the database, it is overwritten..RE.RE.PPThe function `tcmdbput2' is used in order to store a string record into an on\-memory hash database object..PP.RS.br\fBvoid tcmdbput2(TCMDB *\fImdb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RS`\fIvstr\fR' specifies the string of the value..RE.RSIf a record with the same key exists in the database, it is overwritten..RE.RE.PPThe function `tcmdbput3' is used in order to store a record of the value of two regions into an on\-memory hash database object..PP.RS.br\fBvoid tcmdbput3(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIfvbuf\fB, int \fIfvsiz\fB, const void *\fIlvbuf\fB, int \fIlvsiz\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIfvbuf\fR' specifies the pointer to the former region of the value..RE.RS`\fIfvsiz\fR' specifies the size of the former region of the value..RE.RS`\fIlvbuf\fR' specifies the pointer to the latter region of the value..RE.RS`\fIlvsiz\fR' specifies the size of the latter region of the value..RE.RSIf a record with the same key exists in the database, it is overwritten..RE.RE.PPThe function `tcmdbputkeep' is used in order to store a new record into an on\-memory hash database object..PP.RS.br\fBbool tcmdbputkeep(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIvbuf\fR' specifies the pointer to the region of the value..RE.RS`\fIvsiz\fR' specifies the size of the region of the value..RE.RSIf successful, the return value is true, else, it is false..RE.RSIf a record with the same key exists in the database, this function has no effect..RE.RE.PPThe function `tcmdbputkeep2' is used in order to store a new string record into an on\-memory hash database object..PP.RS.br\fBbool tcmdbputkeep2(TCMDB *\fImdb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RS`\fIvstr\fR' specifies the string of the value..RE.RSIf successful, the return value is true, else, it is false..RE.RSIf a record with the same key exists in the database, this function has no effect..RE.RE.PPThe function `tcmdbputcat' is used in order to concatenate a value at the end of the existing record in an on\-memory hash database..PP.RS.br\fBvoid tcmdbputcat(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIvbuf\fR' specifies the pointer to the region of the value..RE.RS`\fIvsiz\fR' specifies the size of the region of the value..RE.RSIf there is no corresponding record, a new record is created..RE.RE.PPThe function `tcmdbputcat2' is used in order to concatenate a string at the end of the existing record in an on\-memory hash database..PP.RS.br\fBvoid tcmdbputcat2(TCMDB *\fImdb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RS`\fIvstr\fR' specifies the string of the value..RE.RSIf there is no corresponding record, a new record is created..RE.RE.PPThe function `tcmdbout' is used in order to remove a record of an on\-memory hash database object..PP.RS.br\fBbool tcmdbout(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RSIf successful, the return value is true.  False is returned when no record corresponds to the specified key..RE.RE.PPThe function `tcmdbout2' is used in order to remove a string record of an on\-memory hash database object..PP.RS.br\fBbool tcmdbout2(TCMDB *\fImdb\fB, const char *\fIkstr\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is true.  False is returned when no record corresponds to the specified key..RE.RE.PPThe function `tcmdbget' is used in order to retrieve a record in an on\-memory hash database object..PP.RS.br\fBvoid *tcmdbget(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the value of the corresponding record.  `NULL' is returned when no record corresponds..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string.  Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tcmdbget2' is used in order to retrieve a string record in an on\-memory hash database object..PP.RS.br\fBchar *tcmdbget2(TCMDB *\fImdb\fB, const char *\fIkstr\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is the string of the value of the corresponding record.  `NULL' is returned when no record corresponds..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -