You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "ferrirW (via GitHub)" <gi...@apache.org> on 2023/01/30 07:43:15 UTC

[GitHub] [rocketmq-schema-registry] ferrirW commented on issue #49: Support cache for SchemaRegistryClient

ferrirW commented on issue #49:
URL: https://github.com/apache/rocketmq-schema-registry/issues/49#issuecomment-1408128717

   > 2. 我理解缓存主要应用于getschema的各个函数中,但由于查询的入参组合种类很多,我可能不得不对于每种组合都进行缓存。例如对于getSchemaByRecordId函数,缓存的key需要设置为SubjectAndId;而在getSchemaBySubjectAndVersion中,缓存的key则需要为SubjectAndVersion,因此就需要两个map来进行分别存储。这种方法的缺点在于会存在一些重复的value,占用的空间更多,因此想和您讨论一下是否有更好的解决方法。
   
   也许我们可以使用一个根 cache 来缓存数据,例如 <Pair<subject, recordId>, GetSchemaResponse>,其他不同的接口仅仅是对其 key 的构造,例如 getSchemaBySubjectAndVersion 中的 version 可以通过雪花算法的逆向与 recordId 进行匹配;
   
   当然现在的重复的占用仅是引用,我认为开销可以接受
    
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org