public class InMemoryCache<K,V> extends Object implements LookupCache<K,V>
| Constructor and Description |
|---|
InMemoryCache(Serializer<K,V> serializer) |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Integer> |
clearSubjects(String subject)
Clears the cache of deleted schemas that match the given subject.
|
void |
close() |
Config |
config(String subject,
boolean returnTopLevelIfNotFound,
Config defaultForTopLevel)
Retrieves the config for a subject.
|
boolean |
containsSchema(Schema schema)
Checks if a schema is registered in any subject.
|
V |
delete(K key) |
void |
flush() |
V |
get(K key) |
CloseableIterator<V> |
getAll(K key1,
K key2)
Iterator over keys in the specified range
|
CloseableIterator<K> |
getAllKeys() |
boolean |
hasSubjects(String subject,
boolean lookupDeletedSubjects)
Returns whether there exist schemas (that are not deleted) that match the given subject.
|
void |
init() |
protected Predicate<String> |
matchingSubjectPredicate(String subject) |
Mode |
mode(String subject,
boolean returnTopLevelIfNotFound,
Mode defaultForTopLevel)
Retrieves the mode for a subject.
|
V |
put(K key,
V value) |
void |
putAll(Map<K,V> entries) |
Set<Integer> |
referencesSchema(SchemaKey schema)
Returns schemas that reference the given schema.
|
void |
schemaDeleted(SchemaKey schemaKey,
SchemaValue schemaValue,
SchemaValue oldSchemaValue)
Callback that is invoked when a schema is deleted.
|
SchemaIdAndSubjects |
schemaIdAndSubjects(Schema schema)
Provides SchemaIdAndSubjects associated with the schema.
|
SchemaKey |
schemaKeyById(Integer id,
String subject)
Provides the
SchemaKey for the provided schema id. |
void |
schemaRegistered(SchemaKey schemaKey,
SchemaValue schemaValue,
SchemaValue oldSchemaValue)
Callback that is invoked when a schema is registered.
|
void |
schemaTombstoned(SchemaKey schemaKey,
SchemaValue schemaValue)
Callback that is invoked when a schema is tombstoned.
|
Set<String> |
subjects(String subject,
boolean lookupDeletedSubjects)
Returns subjects that have schemas (that are not deleted) that match the given subject.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompatibilityLevel, setTenant, tenantisPersistentpublic InMemoryCache(Serializer<K,V> serializer)
public void init()
throws StoreInitializationException
init in interface Store<K,V>StoreInitializationExceptionpublic V get(K key) throws StoreException
get in interface Store<K,V>StoreExceptionpublic V put(K key, V value) throws StoreException
put in interface Store<K,V>StoreExceptionpublic CloseableIterator<V> getAll(K key1, K key2) throws StoreException
StoregetAll in interface Store<K,V>key1 - If key1 is null, start from the first key in sorted orderkey2 - If key2 is null, end at the last keyStoreExceptionpublic void putAll(Map<K,V> entries) throws StoreException
putAll in interface Store<K,V>StoreExceptionpublic V delete(K key) throws StoreException
delete in interface Store<K,V>StoreExceptionpublic CloseableIterator<K> getAllKeys() throws StoreException
getAllKeys in interface Store<K,V>StoreExceptionpublic void flush()
throws StoreException
flush in interface Store<K,V>StoreExceptionpublic void close()
throws StoreException
close in interface Store<K,V>close in interface AutoCloseableStoreExceptionpublic SchemaIdAndSubjects schemaIdAndSubjects(Schema schema) throws StoreException
LookupCacheschemaIdAndSubjects in interface LookupCache<K,V>schema - schema object; never nullStoreExceptionpublic boolean containsSchema(Schema schema) throws StoreException
LookupCachecontainsSchema in interface LookupCache<K,V>schema - schema objectStoreExceptionpublic Set<Integer> referencesSchema(SchemaKey schema) throws StoreException
LookupCachereferencesSchema in interface LookupCache<K,V>schema - schema objectStoreExceptionpublic SchemaKey schemaKeyById(Integer id, String subject) throws StoreException
LookupCacheSchemaKey for the provided schema id.schemaKeyById in interface LookupCache<K,V>id - the schema id; never nullsubject - the qualified context or subjectSchemaKey if found, otherwise null.StoreExceptionpublic void schemaDeleted(SchemaKey schemaKey, SchemaValue schemaValue, SchemaValue oldSchemaValue)
LookupCacheschemaDeleted in interface LookupCache<K,V>schemaKey - the deleted SchemaKey; never nullschemaValue - the deleted SchemaValue; never nulloldSchemaValue - the previous SchemaValuepublic void schemaTombstoned(SchemaKey schemaKey, SchemaValue schemaValue)
LookupCacheschemaTombstoned in interface LookupCache<K,V>schemaKey - the tombstoned SchemaKey; never nullschemaValue - the tombstoned SchemaValuepublic void schemaRegistered(SchemaKey schemaKey, SchemaValue schemaValue, SchemaValue oldSchemaValue)
LookupCacheschemaRegistered in interface LookupCache<K,V>schemaKey - the registered SchemaKey; never nullschemaValue - the registered SchemaValue; never nulloldSchemaValue - the previous SchemaValuepublic Config config(String subject, boolean returnTopLevelIfNotFound, Config defaultForTopLevel) throws StoreException
LookupCacheconfig in interface LookupCache<K,V>subject - the subjectreturnTopLevelIfNotFound - whether to return the top level scope if not founddefaultForTopLevel - default value for the top level scopeStoreExceptionpublic Mode mode(String subject, boolean returnTopLevelIfNotFound, Mode defaultForTopLevel) throws StoreException
LookupCachemode in interface LookupCache<K,V>subject - the subjectreturnTopLevelIfNotFound - whether to return the top level scope if not founddefaultForTopLevel - default value for the top level scopeStoreExceptionpublic Set<String> subjects(String subject, boolean lookupDeletedSubjects) throws StoreException
LookupCachesubjects in interface LookupCache<K,V>subject - the subject, or null for all subjectsStoreExceptionpublic boolean hasSubjects(String subject, boolean lookupDeletedSubjects) throws StoreException
LookupCachehasSubjects in interface LookupCache<K,V>subject - the subject, or null for all subjectsStoreExceptionpublic Map<String,Integer> clearSubjects(String subject) throws StoreException
LookupCacheclearSubjects in interface LookupCache<K,V>subject - the subject, or null for all subjectsStoreExceptionCopyright © 2026 Confluent, Inc.. All rights reserved.