• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConcurrentLinkedHashMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ConcurrentLinkedHashMap类属于com.thimbleware.jmemcached.storage.hash包,在下文中一共展示了ConcurrentLinkedHashMap类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: start

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入依赖的package包/类
public void start(final String host, final int port) {
    logger.debug("Starting memcache...");

    final CountDownLatch startupLatch = new CountDownLatch(1);
    ExecutorService executor = Executors.newSingleThreadExecutor();
    executor.execute(new Runnable() {
        @Override
        public void run() {
            CacheStorage<Key, LocalCacheElement> storage = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap
                    .EvictionPolicy.FIFO, DEFAULT_STORAGE_CAPACITY, DEFAULT_STORAGE_MEMORY_CAPACITY);
            memcacheDaemon = new MemCacheDaemon<>();
            memcacheDaemon.setCache(new CacheImpl(storage));
            memcacheDaemon.setAddr(new InetSocketAddress(host, port));
            memcacheDaemon.start();
            startupLatch.countDown();
        }
    });
    try {
        if (!startupLatch.await(DEFAULT_STARTUP_TIMEOUT, MILLISECONDS)) {
            logger.error("Memcache daemon did not start after {}ms. Consider increasing the timeout", MILLISECONDS);
            throw new AssertionError("Memcache daemon did not start within timeout");
        }
    } catch (InterruptedException e) {
        logger.error("Interrupted waiting for Memcache daemon to start:", e);
        throw new AssertionError(e);
    }
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:28,代码来源:JMemcachedServer.java


示例7: 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


示例8: 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


示例9: start

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入依赖的package包/类
@Override
public void start(final String host, final int port) {
    logger.debug("Starting memcache...");

    final CountDownLatch startupLatch = new CountDownLatch(1);
    ExecutorService executor = Executors.newSingleThreadExecutor();
    executor.execute(new Runnable() {
        @Override
        public void run() {
            CacheStorage<Key, LocalCacheElement> storage = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap
                .EvictionPolicy.FIFO, DEFAULT_STORAGE_CAPACITY, DEFAULT_STORAGE_MEMORY_CAPACITY);
            memcacheDaemon = new MemCacheDaemon<>();
            memcacheDaemon.setCache(new CacheImpl(storage));
            memcacheDaemon.setAddr(new InetSocketAddress(host, port));
            memcacheDaemon.start();
            startupLatch.countDown();
        }
    });
    try {
        if (!startupLatch.await(DEFAULT_STARTUP_TIMEOUT, MILLISECONDS)) {
            logger.error("Memcache daemon did not start after {}ms. Consider increasing the timeout", MILLISECONDS);
            throw new AssertionError("Memcache daemon did not start within timeout");
        }
    } catch (InterruptedException e) {
        logger.error("Interrupted waiting for Memcache daemon to start:", e);
        throw new AssertionError(e);
    }
}
 
开发者ID:mwarc,项目名称:embedded-memcached-spring,代码行数:29,代码来源:JMemcachedServer.java


示例10: 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


示例11: 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


示例12: createCacheDaemon

import com.thimbleware.jmemcached.storage.hash.ConcurrentLinkedHashMap; //导入依赖的package包/类
private static void createCacheDaemon() {
  if (cacheDaemon != null) {
    return;
  }
  cacheDaemon = new MemCacheDaemon<>();
  cacheDaemon.setCache(new CacheImpl(ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.FIFO, 1000, 4194304)));
  cacheDaemon.setAddr(new InetSocketAddress(MEMCACHED_PORT));
  cacheDaemon.setBinary(false); // NOTE: JMemcached seem to have binary protocol bugs...
  cacheDaemon.setVerbose(false);
  cacheDaemon.start();
}
 
开发者ID:outbrain,项目名称:ob1k,代码行数:12,代码来源:AbstractMemcachedClientTest.java


示例13: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ControllerId类代码示例发布时间:2022-05-22
下一篇:
Java ElementChange类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap