我现在想存50来个键值对,内容比较少,所以不想用MYSQL这样的数据库,我需要多次同时读取里面的值,最好便于查找,比如我要读第21个键值对,而且要能承受多次反复的读取,我的意思是强度挺大,现在想到的方法是CVS,XML,不知还有其他方法吗,如果有,请给出具体建议,非常感谢,需要有C++接口。 SQLITE我也试过,但不知它是否能承受多次同时查询?
PHPz2017-04-17 11:05:21
If the amount of data is so small, as OpenFibers said, you can consider storing it directly in the memory, but your difficulty is probably what type of key is this key-value and whether multiple programs need to read it at the same time. If it is a basic type Of course, you can just use map directly. If it is not a basic type, you can provide a hash algorithm to calculate a unique index for this key, and then use this index to create a map, which should also meet the requirements. If you want multiple processes to read, you can consider using shared memory to save data and synchronize control of write operations. Don't feel the need to use SQLite etc.