网站预计会有很大的查询量,相比之下写入数据库的操作要少很多。
我想的是把数据库内容分成两种,一种是用于索引的内容,内容包含各种所需信息对应的索引项,另一种是其他所要查询的具体数据内容。
先将具体内容存入memcache,查询时通过从数据库中得到的索引值再从memcache中取得对应数据;
写入数据时则直接写到mongodb中;
不知道这种做法有什么不妥,来这寻求下建议~~
天蓬老师2017-04-24 16:01:35
This is a typical caching usage scenario. Based on the technical solution you use, there are several points that need to be considered clearly:
我想大声告诉你2017-04-24 16:01:35
"First store the specific content in memcache, and then obtain the corresponding data from memcache through the index value obtained from the database during query;" I don't quite understand this sentence. Should the data be saved in the cache? If the downtime data is not It’s gone.
高洛峰2017-04-24 16:01:35
I don’t know how much business the poster has. Mongodb is a hybrid database. Even Mongodb also has an in-memory database part. Mongodb is not a bad writing bottleneck, so the reading business should be placed in a pure in-memory database like redis. For business, there is no need to go through the trouble. Wouldn’t it be better to save it directly in mongo?