com.aerospike.jdbc.schema.AerospikeSchemaCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aerospike-jdbc Show documentation
Show all versions of aerospike-jdbc Show documentation
A JDBC driver for the Aerospike database
package com.aerospike.jdbc.schema;
import com.aerospike.jdbc.model.CatalogTableName;
import com.aerospike.jdbc.model.DataColumn;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
public final class AerospikeSchemaCache
implements OptionalCache> {
private final Cache> store;
public AerospikeSchemaCache(Duration ttl) {
store = CacheBuilder.newBuilder().expireAfterWrite(ttl).build();
}
@Override
public Optional> get(CatalogTableName catalogTableName) {
return Optional.ofNullable(store.getIfPresent(catalogTableName));
}
@Override
public void put(CatalogTableName catalogTableName, List columns) {
store.put(catalogTableName, columns);
}
@Override
public void clear() {
store.invalidateAll();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy