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


Java ConcurrentLinkedHashMap.create方法代码示例

本文整理汇总了Java中com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap.create方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentLinkedHashMap.create方法的具体用法?Java ConcurrentLinkedHashMap.create怎么用?Java ConcurrentLinkedHashMap.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap的用法示例。


在下文中一共展示了ConcurrentLinkedHashMap.create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCacheStorage

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
private CacheStorage<Key, LocalCacheElement> getCacheStorage() throws IOException {
    CacheStorage<Key, LocalCacheElement> cacheStorage = null;
    switch (cacheType) {
        case LOCAL_HASH:
            cacheStorage = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.FIFO, MAX_SIZE, MAX_BYTES);
            break;
        case BLOCK:
            cacheStorage = new BlockStorageCacheStorage(16, CEILING_SIZE, blockSize, MAX_BYTES, MAX_SIZE, new ByteBufferBlockStore.ByteBufferBlockStoreFactory());
            break;
        case MAPPED:
            cacheStorage = new BlockStorageCacheStorage(16, CEILING_SIZE, blockSize, MAX_BYTES, MAX_SIZE, MemoryMappedBlockStore.getFactory());

            break;
    }
    return cacheStorage;
}
 
开发者ID:rdaum,项目名称:jmemcache-daemon,代码行数:17,代码来源:AbstractCacheTest.java

示例2: startServer

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
public static int startServer() {
    if (daemon == null) {
        System.setProperty("net.spy.log.LoggerImpl", SLF4JLogger.class.getName());

        // Get next free port for the test server
        portForInstance = SocketUtils.findAvailableTcpPort();

        //noinspection NonThreadSafeLazyInitialization
        daemon = new MemCacheDaemon<>();
        CacheStorage<Key, LocalCacheElement> storage = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.FIFO, 1024 * 1024, 1024 * 1024 * 1024);
        daemon.setCache(new CacheImpl(storage));
        daemon.setAddr(new InetSocketAddress(portForInstance));
        daemon.setVerbose(true);
        daemon.start();
    }
    return portForInstance;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-aws,代码行数:18,代码来源:TestMemcacheServer.java

示例3: startMemcachedDaemon

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
private static MemcachedDaemonWrapper startMemcachedDaemon(int port, boolean binary) {
    try {
        MemCacheDaemon<LocalCacheElement> daemon = new MemCacheDaemon<LocalCacheElement>();


        CacheStorage<Key, LocalCacheElement> cacheStorage = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.LRU, 1000, 512000);
        Cache<LocalCacheElement> cacheImpl = new CacheImpl(cacheStorage);
        daemon.setCache(cacheImpl);
        daemon.setAddr(new InetSocketAddress("localhost", port));
        daemon.setIdleTime(100000);
        daemon.setBinary(binary);
        daemon.setVerbose(true);
        daemon.start();
        Thread.sleep(500);
        return new MemcachedDaemonWrapper(daemon, port);
    } catch (Exception e) {
        logger.error("Error starting memcached", e);
        return new MemcachedDaemonWrapper(null, port);
    }

}
 
开发者ID:tootedom,项目名称:tomcat-memcached-response-filter,代码行数:22,代码来源:MemcachedDaemonFactory.java

示例4: BlockStorageCacheStorage

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
public BlockStorageCacheStorage(int blockStoreBuckets, int ceilingBytesParam, int blockSizeBytes, long maximumSizeBytes, int maximumItemsVal, BlockStoreFactory factory) {
    this.blockStorage = new ByteBufferBlockStore[blockStoreBuckets];
    this.storageLock= new ReentrantReadWriteLock[blockStoreBuckets];

    long bucketSizeBytes = maximumSizeBytes / blockStoreBuckets;
    for (int i = 0; i < blockStoreBuckets; i++) {
        this.blockStorage[i] = factory.manufacture(bucketSizeBytes, blockSizeBytes);
        this.storageLock[i] = new ReentrantReadWriteLock();
    }

    this.ceilingBytes = new AtomicInteger(ceilingBytesParam);
    this.maximumItems = new AtomicInteger(maximumItemsVal);
    this.maximumSizeBytes = maximumSizeBytes;

    this.index = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.LRU, maximumItemsVal, maximumSizeBytes, new ConcurrentLinkedHashMap.EvictionListener<Key, StoredValue>(){
        public void onEviction(Key key, StoredValue value) {
            value.free();
        }
    });
}
 
开发者ID:callan,项目名称:jmemcached,代码行数:21,代码来源:BlockStorageCacheStorage.java

示例5: main

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
public static void main(String[] args) {
       // create daemon and start it
	Logger log = LogManager.getLogger("QuickTest");
	
       MemCacheDaemon daemon = new MemCacheDaemon<LocalCacheElement>();
       CacheStorage<Key, LocalCacheElement> map = ConcurrentLinkedHashMap.create(
       						ConcurrentLinkedHashMap.EvictionPolicy.FIFO, MAX_SIZE, MAX_BYTES);
       
       daemon.setCache(new CacheImpl(map));
       daemon.setBinary(false);
       
       daemon.setAddr(new InetSocketAddress(11211));
       daemon.setVerbose(false);
       
       try {
       	daemon.start();
       } catch (Exception e) {
       	e.printStackTrace();
       	return;
       }

       Cache cache = daemon.getCache();
}
 
开发者ID:callan,项目名称:jmemcached,代码行数:24,代码来源:QuickTest.java

示例6: createDaemon

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
public static MemCacheDaemon<? extends CacheElement> createDaemon( final InetSocketAddress address ) throws IOException {
    final MemCacheDaemon<LocalCacheElement> daemon = new MemCacheDaemon<LocalCacheElement>();
    final ConcurrentLinkedHashMap<Key, LocalCacheElement> cacheStorage = ConcurrentLinkedHashMap.create(
            EvictionPolicy.LRU, 100000, 1024*1024 );
    daemon.setCache( new CacheImpl( cacheStorage ) );
    daemon.setAddr( address );
    daemon.setVerbose( false );
    return daemon;
}
 
开发者ID:rdaum,项目名称:jmemcache-daemon,代码行数:10,代码来源:Issue24RegressionTest.java

示例7: setup

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
@Before
public void setup() throws InterruptedException {

    // create daemon and start it
    final CacheStorage<Key, LocalCacheElement> storage = ConcurrentLinkedHashMap
            .create(ConcurrentLinkedHashMap.EvictionPolicy.FIFO, 10000,
                    10000);
    daemon.setCache(new CacheImpl(storage));
    daemon.setBinary(true);
    daemon.setAddr(new InetSocketAddress(11242));
    daemon.setIdleTime(1000);
    daemon.setVerbose(true);
    daemon.start();
}
 
开发者ID:kenzanlabs,项目名称:bowtie,代码行数:15,代码来源:MemcacheRestCacheTest.java

示例8: defaultCache

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
private static CacheImpl defaultCache() {
  final int maxItems = 1492;
  final int maxBytes = 1024 * 1000;
  final ConcurrentLinkedHashMap<Key, LocalCacheElement> storage = ConcurrentLinkedHashMap.create(
      ConcurrentLinkedHashMap.EvictionPolicy.FIFO, maxItems, maxBytes);
  return new CacheImpl(storage);
}
 
开发者ID:spotify,项目名称:folsom,代码行数:8,代码来源:EmbeddedServer.java

示例9: build

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
private MemCacheDaemon<LocalCacheElement> build(final Server server) {
    final MemCacheDaemon<LocalCacheElement> daemon = new MemCacheDaemon<LocalCacheElement>();

    CacheStorage<Key, LocalCacheElement> storage = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.FIFO,
            server.getMaximumCapacity(), server.getMaximumMemoryCapacity());
    daemon.setCache(new CacheImpl(storage));
    daemon.setBinary(server.isBinary());
    daemon.setAddr(new InetSocketAddress("localhost", server.getPort()));
    daemon.setVerbose(server.isVerbose());
    
    return daemon;
}
 
开发者ID:ragnor,项目名称:simple-spring-memcached,代码行数:13,代码来源:AbstractJmemcachedMojo.java

示例10: afterPropertiesSet

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {

	logger.info("Initializing JMemcached Server");

	jmemcached = new MemCacheDaemon<LocalCacheElement>();

	CacheStorage<Key, LocalCacheElement> storage = ConcurrentLinkedHashMap.create(
			ConcurrentLinkedHashMap.EvictionPolicy.FIFO, maxItems, maxBytes);
	jmemcached.setCache(new CacheImpl(storage));

	jmemcached.setAddr(AddrUtil.getAddresses(serverUrl).get(0));

	jmemcached.start();

	logger.info("Initialized JMemcached Server");
}
 
开发者ID:pengqiuyuan,项目名称:g2,代码行数:18,代码来源:MemcachedSimulator.java


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