1 Star 0 Fork 39

luyulonglujie@163.com / atoms

forked from joliny / atoms 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Readme.md 1.78 KB
一键复制 编辑 原始数据 按行查看 历史
joliny 提交于 2017-03-15 15:29 . 修改ReadMe

基于j2cache的理念,重新设计开发的一套分布式缓存。。

github地址:atoms

Who's using atoms?

职通网 [职通网] (http://www.zhitongjob.com)

配置文件

<?xml version="1.0" encoding="UTF-8"?>
<atoms>
	<broadcast type="redis" >
		<broadcastConfig host="192.168.1.53" port="6379"/>
	</broadcast>
	<serializer type="fst"/>
	<cache level="1" type="ehcache" delete_atom="true" ><!-- expiredOperator="update" waitTime="100" --><!-- expiredOperator: update,delete  当为update时waitTime有效-->
		<cacheConfig configFile="ehcache.xml"/>
		<cacheTTL>
			<ttl name="hello" value="1000"/><!-- name:regionName value:失效时间 单位(秒) -->
		</cacheTTL>
	</cache>
	<cache level="2" type="redis">
		<cacheConfig host="192.168.1.53" port="6379" timeout="2000" database="13" namespace="atoms" maxTotal="-1" maxIdle="2000"
		 maxWaitMillis="100" minEvictableIdleTimeMillis="864000000" minIdle="1000" numTestsPerEvictionRun="10" lifo="false"
		 softMinEvictableIdleTimeMillis="10" testOnBorrow="true" testOnReturn="false" testWhileIdle="false" timeBetweenEvictionRunsMillis="300000"
		 blockWhenExhausted="true" password=""/>
		<cacheTTL>
			<ttl name="hello" value="3000"/><!-- name:regionName value:失效时间 单位(秒) -->
		</cacheTTL>
	</cache>
</atoms>

使用代码:

CacheChannel cc=CacheChannel.getInstance();
cc.set("jobell", "hello", "nihaoya");
cc.evict("jobell", "hello");
while(true){
	Object value=cc.get("jobell", "hello");
	if(value==null){
		System.out.println("==============="+value);
	}else{
		System.out.println("==============="+value);
	}
}

Spring配置参考atoms-config/src/test/resources/applicationContext.xml

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/tianqueluyulong/atoms.git
git@gitee.com:tianqueluyulong/atoms.git
tianqueluyulong
atoms
atoms
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891