eolivelli commented on code in PR #17401:
URL: https://github.com/apache/pulsar/pull/17401#discussion_r960820926
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/MetadataStore.java:
##########
@@ -136,27 +136,78 @@ public interface MetadataStore extends AutoCloseable {
* @param <T>
* @param clazz
* the class type to be used for serialization/deserialization
+ * @param cacheConfig
+ * the cache configuration to be used
* @return the metadata cache object
*/
- <T> MetadataCache<T> getMetadataCache(Class<T> clazz);
+ <T> MetadataCache<T> getMetadataCache(Class<T> clazz, MetadataCacheConfig
cacheConfig);
+
+ /**
+ * Create a metadata cache specialized for a specific class.
+ *
+ * @param <T>
+ * @param clazz
+ * the class type to be used for serialization/deserialization
+ * @return the metadata cache object
+ */
+ default <T> MetadataCache<T> getMetadataCache(Class<T> clazz) {
+ return getMetadataCache(clazz, getDefaultMetadataCacheConfig());
+ }
/**
* Create a metadata cache specialized for a specific class.
*
* @param <T>
* @param typeRef
* the type ref description to be used for
serialization/deserialization
+ * @param cacheConfig
+ * the cache configuration to be used
* @return the metadata cache object
*/
- <T> MetadataCache<T> getMetadataCache(TypeReference<T> typeRef);
+ <T> MetadataCache<T> getMetadataCache(TypeReference<T> typeRef,
MetadataCacheConfig cacheConfig);
+
+ /**
+ * Create a metadata cache specialized for a specific class.
+ *
+ * @param <T>
+ * @param typeRef
+ * the type ref description to be used for
serialization/deserialization
+ * @return the metadata cache object
+ */
+ default <T> MetadataCache<T> getMetadataCache(TypeReference<T> typeRef) {
+ return getMetadataCache(typeRef, getDefaultMetadataCacheConfig());
+ }
/**
* Create a metadata cache that uses a particular serde object.
*
* @param <T>
* @param serde
* the custom serialization/deserialization object
+ * @param cacheConfig
+ * the cache configuration to be used
* @return the metadata cache object
*/
- <T> MetadataCache<T> getMetadataCache(MetadataSerde<T> serde);
+ <T> MetadataCache<T> getMetadataCache(MetadataSerde<T> serde,
MetadataCacheConfig cacheConfig);
+
+ /**
+ * Create a metadata cache that uses a particular serde object.
+ *
+ * @param <T>
+ * @param serde
+ * the custom serialization/deserialization object
+ * @return the metadata cache object
+ */
+ default <T> MetadataCache<T> getMetadataCache(MetadataSerde<T> serde) {
+ return getMetadataCache(serde, getDefaultMetadataCacheConfig());
+ }
+
+ /**
+ * Returns the default metadata cache config.
+ *
+ * @return default metadata cache config
+ */
+ default MetadataCacheConfig getDefaultMetadataCacheConfig() {
+ return MetadataCacheConfig.builder().build();
Review Comment:
we can make in "final" in order to prevent subclassing
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]