confluent-schema-registry
confluent-schema-registry copied to clipboard
Is there any caching in place?
Is there any schema caching (memoization) in the SchemaRegistry client? For example, will the following snippet generate more than 1 API call?
let response: any = SchemaRegistry.getLatestSchemaId("foo"); // calls API
response = SchemaRegistry.getLatestSchemaId("foo"); // return cached value, does not call API
If anyone is interested in the answer, encode, decode and getSchema do cache the schema by id and do not make new API calls for schemas they already know.
getLatestSchemaId obviously should not cache, since you can never know if the latest schema updated in between calls.
getRegistryId and register also do not cache, but I think they could do so.
If you get the schema ID for a tuple (subject, version), that will never change (unless version value is "latest", in which case you again cannot cache anything). Also, registering the same schema under the same subject multiple times will just yield in the same schema ID (idempotent operation), or at least I think it will.
I think it would be good to mention this in the docs and in the usage examples, or even better - consider implementing the memoization for getRegistryId and register
What are your thoughts on this?
I think it would be good to mention this in the docs and in the usage examples, or even better - consider implementing the memoization for getRegistryId and register What are your thoughts on this?
I have no objections 🙂Contributions to the documentation would be awesome and I'm always available for review 👍
Has this been implemented
Also, registering the same schema under the same subject multiple times will just yield in the same schema ID (idempotent operation), or at least I think it will.
It will.