當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。