当前位置: 首页>>代码示例>>Java>>正文


Java LRUCache类代码示例

本文整理汇总了Java中org.apache.kafka.common.cache.LRUCache的典型用法代码示例。如果您正苦于以下问题:Java LRUCache类的具体用法?Java LRUCache怎么用?Java LRUCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LRUCache类属于org.apache.kafka.common.cache包,在下文中一共展示了LRUCache类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
    final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
    topicField = InsertionSpec.parse(config.getString(ConfigName.TOPIC_FIELD));
    partitionField = InsertionSpec.parse(config.getString(ConfigName.PARTITION_FIELD));
    offsetField = InsertionSpec.parse(config.getString(ConfigName.OFFSET_FIELD));
    timestampField = InsertionSpec.parse(config.getString(ConfigName.TIMESTAMP_FIELD));
    staticField = InsertionSpec.parse(config.getString(ConfigName.STATIC_FIELD));
    staticValue = config.getString(ConfigName.STATIC_VALUE);

    if (topicField == null && partitionField == null && offsetField == null && timestampField == null && staticField == null) {
        throw new ConfigException("No field insertion configured");
    }

    if (staticField != null && staticValue == null) {
        throw new ConfigException(ConfigName.STATIC_VALUE, null, "No value specified for static field: " + staticField);
    }

    schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:21,代码来源:InsertField.java

示例2: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
    final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
    casts = parseFieldTypes(config.getList(SPEC_CONFIG));
    wholeValueCastType = casts.get(WHOLE_VALUE_CAST);
    schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:8,代码来源:Cast.java

示例3: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> configs) {
    final SimpleConfig config = new SimpleConfig(CONFIG_DEF, configs);
    blacklist = config.getList(ConfigName.BLACKLIST);
    whitelist = config.getList(ConfigName.WHITELIST);
    renames = parseRenameMappings(config.getList(ConfigName.RENAME));
    reverseRenames = invert(renames);

    schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:11,代码来源:ReplaceField.java

示例4: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
    Object enableConfigsVal = configs.get(SCHEMAS_ENABLE_CONFIG);
    if (enableConfigsVal != null)
        enableSchemas = enableConfigsVal.toString().equals("true");

    serializer.configure(configs, isKey);
    deserializer.configure(configs, isKey);

    Object cacheSizeVal = configs.get(SCHEMAS_CACHE_SIZE_CONFIG);
    if (cacheSizeVal != null)
        cacheSize = Integer.parseInt((String) cacheSizeVal);
    fromConnectSchemaCache = new SynchronizedCache<>(new LRUCache<Schema, ObjectNode>(cacheSize));
    toConnectSchemaCache = new SynchronizedCache<>(new LRUCache<JsonNode, Schema>(cacheSize));
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:16,代码来源:JsonConverter.java

示例5: setUpCaches

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Setup(Level.Trial)
public void setUpCaches() {
    lruCache = new LRUCache<>(100);
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:5,代码来源:LRUCacheBenchmark.java

示例6: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> configs) {
    final SimpleConfig config = new SimpleConfig(CONFIG_DEF, configs);
    fields = config.getList(FIELDS_CONFIG);
    valueToKeySchemaCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:7,代码来源:ValueToKey.java

示例7: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
    final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
    delimiter = config.getString(DELIMITER_CONFIG);
    schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:7,代码来源:Flatten.java

示例8: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
    final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
    fieldName = config.getString("field");
    schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:7,代码来源:HoistField.java

示例9: configure

import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, String> properties) {
  schemaCache = new SynchronizedCache<>(new LRUCache<String, Schema>(CACHE_SIZE));
}
 
开发者ID:wepay,项目名称:kafka-connect-bigquery,代码行数:5,代码来源:MemorySchemaRetriever.java


注:本文中的org.apache.kafka.common.cache.LRUCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。