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

📄 tcutil.3

📁 Tokyo Cabinet的Tokyo Cabinet 是一个DBM的实现。这里的数据库由一系列key-value对的记录构成。key和value都可以是任意长度的字节序列,既可以是二进制也可以是字符
💻 3
📖 第 1 页 / 共 5 页
字号:
`\fIcmpop\fR' specifies an arbitrary pointer to be given as a parameter of the comparison function..RE.RSIf it is not needed, `NULL' can be specified..RE.RSThe return value is a new tree object..RE.RSBecause the object of the return value is created with the function `tctreenew', it should be deleted with the function `tctreedel' when it is no longer in use..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 `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..RE.RE.PPThe function `tcmdbvsiz' is used in order to get the size of the value of a record in an on\-memory hash database object..PP.RS.br\fBint tcmdbvsiz(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 the size of the value of the corresponding record, else, it is \-1..RE.RE.PPThe function `tcmdbvsiz2' is used in order to get the size of the value of a string record in an on\-memory hash database object..PP.RS.br\fBint tcmdbvsiz2(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 size of the value of the corresponding record, else, it is \-1..RE.RE.PPThe function `tcmdbiterinit' is used in order to initialize the iterator of an on\-memory hash database object..PP.RS.br\fBvoid tcmdbiterinit(TCMDB *\fImdb\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RSThe iterator is used in order to access the key of every record stored in the on\-memory hash database..RE.RE.PPThe function `tcmdbiternext' is used in order to get the next key of the iterator of an on\-memory hash database object..PP.RS.br\fBvoid *tcmdbiternext(TCMDB *\fImdb\fB, int *\fIsp\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return.RE.RSvalue is assigned..RE.RSIf successful, the return value is the pointer to the region of the next key, else, it is `NULL'.  `NULL' is returned when no record can be fetched from the iterator..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.  The order of iteration is assured to be the same as the stored order..RE.RE.PPThe function `tcmdbiternext2' is used in order to get the next key string of the iterator of an on\-memory hash database object..PP.RS.br\fBchar *tcmdbiternext2(TCMDB *\fImdb\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RSIf successful, the return value is the pointer to the region of the next key, else, it is `NULL'.  `NULL' is returned when no record can be fetched from the iterator..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.  The order of iteration is assured to be the same as the stored order..RE.RE.PPThe function `tcmdbfwmkeys' is used in order to get forward matching keys in an on\-memory hash database object..PP.RS.br\fBTCLIST *tcmdbfwmkeys(TCMDB *\fImdb\fB, const void *\fIpbuf\fB, int \fIpsiz\fB, int \fImax\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIpbuf\fR' specifies the pointer to the region of the prefix..RE.RS`\fIpsiz\fR' specifies the size of the region of the prefix..RE.RS`\fImax\fR' specifies the maximum number of keys to be fetched.  If it is negative, no limit is specified..RE.RSThe return value is a list object of the corresponding keys.  This function does never fail and return an empty list even if no key corresponds..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.  Note that this function may be very slow because every key in the database is scanned..RE.RE.PPThe function `tcmdbfwmkeys2' is used in order to get forward matching string keys in an on\-memory hash database object..PP.RS.br\fBTCLIST *tcmdbfwmkeys2(TCMDB *\fImdb\fB, const char *\fIpstr\fB, int \fImax\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RS`\fIpstr\fR' specifies the string of the prefix..RE.RS`\fImax\fR' specifies the maximum number of keys to be fetched.  If it is negative, no limit is specified..RE.RSThe return value is a list object of the corresponding keys.  This function does never fail and return an empty list even if no key corresponds..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.  Note that this function may be very slow because every key in the database is scanned..RE.RE.PPThe function `tcmdbrnum' is used in order to get the number of records stored in an on\-memory hash database object..PP.RS.br\fBuint64_t tcmdbrnum(TCMDB *\fImdb\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RSThe return value is the number of the records stored in the database..RE.RE.PPThe function `tcmdbmsiz' is used in order to get the total size of memory used in an on\-memory hash database object..PP.RS.br\fBuint64_t tcmdbmsiz(TCMDB *\fImdb\fB);\fR.RS`\fImdb\fR' specifies the on\-memory hash database object..RE.RSThe return value is the total size of memory used in the database..RE.RE.PPThe function `tcmdbaddint' is used in order to add an integer to a record in an on\-memory hash database object..PP.RS.br\fBint tcmdbaddint(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\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`\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 `tcmdbadddouble' is used in order to add a real number to a record in an on\-memory hash database object..PP.RS.br\fBdouble tcmdbadddouble(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR.RS`\fImdb\fR' sp

⌨️ 快捷键说明

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