Multiple keys, single value cache implementation

If a record can be uniquely queried by id, idcard, and name,
and three interfaces (supporting the above query) are provided to
store the mapping
key: id idcard name
value: id id id
stores the real value
key: id value: value
required Querying twice (using idcard and name to query)



is to use idcard to query, query the cache, and if there is a value, then use this value to get real data. The first time you fetch the query cache If there is no record, then take the value, save the idcard and the record ID, and check if the record ID exists in the cache. If it does not exist, then cache it to



avoid multiple values ​​being stored and save space.
Cache consistency ( one)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326239022&siteId=291194637