本文整理汇总了Java中com.thimbleware.jmemcached.MemCacheDaemon.setAddr方法的典型用法代码示例。如果您正苦于以下问题:Java MemCacheDaemon.setAddr方法的具体用法?Java MemCacheDaemon.setAddr怎么用?Java MemCacheDaemon.setAddr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thimbleware.jmemcached.MemCacheDaemon
的用法示例。
在下文中一共展示了MemCacheDaemon.setAddr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
}));
}
示例2: 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();
}
示例3: 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;
}
示例4: 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;
}