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

Java MemCacheDaemon类代码示例

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

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



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

示例1: newQueueInstance

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的package包/类
public static void newQueueInstance(int port) {
    InetSocketAddress addr = new InetSocketAddress("0.0.0.0", port);
    int idle = -1;
    boolean verbose = false;
    MemCacheDaemon.memcachedVersion = "0.1";
    final MemCacheDaemon<LocalCacheElement> daemon = new MemCacheDaemon<LocalCacheElement>();
    CacheStorage<String, LocalCacheElement> storage = new FSStorage();
    CacheImpl cacheImpl = new CacheImpl(storage);
    daemon.setCache(cacheImpl);
    daemon.setAddr(addr);
    daemon.setBinary(false);
    daemon.setIdleTime(idle);
    daemon.setVerbose(verbose);
    daemon.start();
    log.info("\r\n\t         FQueue instance started,port:" + port
            + " [version 0.1] \r\n\t\t\t Copyright (C) 2011 sunli");
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        public void run() {
            if (daemon != null && daemon.isRunning())
                daemon.stop();
            log.info("shutdown server");
        }
    }));
}
 
开发者ID:sunli1223,项目名称:fqueue,代码行数:25,代码来源:StartNewQueue.java


示例2: startServer

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的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: main

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的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


示例4: start

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的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


示例5: start

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的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


示例6: EmbeddedServer

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的package包/类
public <E extends CacheElement> EmbeddedServer(final boolean binary, final Cache<E> cache) {
  MemCacheDaemon<E> daemon = new MemCacheDaemon<>();
  daemon.setCache(cache);
  daemon.setBinary(binary);
  daemon.setVerbose(false);
  port = findFreePort();
  daemon.setAddr(new InetSocketAddress(this.port));
  daemon.start();
  this.daemon = daemon;
}
 
开发者ID:spotify,项目名称:folsom,代码行数:11,代码来源:EmbeddedServer.java


示例7: start

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的package包/类
protected void start() {
    if (disabled || servers == null) {
        getLog().info("Skipping starting jmemcached daemons");
        return;
    }

    getLog().info("Startng jmemcached daemons: " + servers);
    if (started) {
        getLog().info("Jmemcached daemons are already started");
        return;
    }

    MemCacheDaemon<LocalCacheElement> daemon;
    daemons = new ArrayList<MemCacheDaemon<LocalCacheElement>>();
    for (Server server : servers) {
        getLog().debug("Creating memcached: " + server);
        daemon = build(server);
        getLog().debug("Starting memcached: " + server);
        daemon.start();
        getLog().info("Memcached has been started: " + server);
        daemons.add(daemon);
    }

    started = true;

    getLog().info("Jmemcached daemons have been started");
}
 
开发者ID:ragnor,项目名称:simple-spring-memcached,代码行数:28,代码来源:AbstractJmemcachedMojo.java


示例8: stop

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的package包/类
protected void stop() {
    if (disabled) {
        return;
    }

    getLog().info("Stoping jmemcached daemons");

    for (MemCacheDaemon<LocalCacheElement> daemon : daemons) {
        daemon.stop();
    }

    started = false;
    getLog().info("Jmemcached daemons have been stopped");
}
 
开发者ID:ragnor,项目名称:simple-spring-memcached,代码行数:15,代码来源:AbstractJmemcachedMojo.java


示例9: build

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的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: createCacheDaemon

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的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


示例11: afterPropertiesSet

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的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


示例12: MemcachedDaemonWrapper

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的package包/类
public MemcachedDaemonWrapper(MemCacheDaemon<LocalCacheElement> daemon,
                              int port) {
    this.daemon = daemon;
    this.port = port;
}
 
开发者ID:tootedom,项目名称:tomcat-memcached-response-filter,代码行数:6,代码来源:MemcachedDaemonWrapper.java


示例13: getDaemon

import com.thimbleware.jmemcached.MemCacheDaemon; //导入依赖的package包/类
public MemCacheDaemon<LocalCacheElement> getDaemon() {
    return daemon;
}
 
开发者ID:tootedom,项目名称:tomcat-memcached-response-filter,代码行数:4,代码来源:MemcachedDaemonWrapper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ErrorResult类代码示例发布时间:2022-05-22
下一篇:
Java TByteByteIterator类代码示例发布时间: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