Java集成各种cache组件 multicache4j
jopen
13年前
<p>multicache4j用于为Java集成各种cache组件: </p> <ul> <li>方便集成各种remote cache </li> <ul> <li>memcached (支持组件spymemcached) </li> <li>memcacheq (支持组件spymemcached) </li> <li>memcachedb (支持组件spymemcached) </li> <li>ttserver (支持组件spymemcached, ttserverclient) </li> <li>redis (支持组件jedis) </li> </ul> <li>方便集成各种local cache </li> <ul> <li>ehcache </li> </ul> <li>基于对象池技术管理客户端连接对象,网络断开能够自动重连 </li> <li>基于<a href="/misc/goto?guid=4959499893313561577" rel="nofollow">Pattern Mapping</a>进行哈希映射 </li> <li>支持remote cache和local cache的混合缓存 </li> <li>支持local cache的单独使用 </li> </ul> <ul> <li>multi cache (remote + local, or remote , or local):混合使用远程与本地Cache </li> </ul> <blockquote> 适用场景:单点应用+集群Cache <pre class="prettyprint"><span class="typ">MultiCacheFactory</span><span class="pun">.</span><span class="pln">getInstance</span><span class="pun">().</span><span class="kwd">set</span><span class="pun">(</span><span class="str">"foo"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"bar"</span><span class="pun">);</span><span class="pln"> </span><span class="typ"> MultiCacheFactory</span><span class="pun">.</span><span class="pln">getInstance</span><span class="pun">().</span><span class="kwd">get</span><span class="pun">(</span><span class="str">"foo"</span><span class="pun">);</span></pre> </blockquote> <ul> <li>remote cache:单独使用远程Cache </li> </ul> <blockquote> 适用场景:多点应用+集群Cache <pre class="prettyprint"><span class="typ">RemoteCacheFactory</span><span class="pun">.</span><span class="pln">getInstance</span><span class="pun">().</span><span class="kwd">set</span><span class="pun">(</span><span class="str">"foo"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"bar"</span><span class="pun">);</span><span class="pln"> </span><span class="typ"> RemoteCacheFactory</span><span class="pun">.</span><span class="pln">getInstance</span><span class="pun">().</span><span class="kwd">get</span><span class="pun">(</span><span class="str">"foo"</span><span class="pun">);</span><span class="pln"> </span><span class="typ"> RemoteCacheFactory</span><span class="pun">.</span><span class="pln">getInstance</span><span class="pun">().</span><span class="kwd">del</span><span class="pun">(</span><span class="str">"foo"</span><span class="pun">);</span></pre> </blockquote> <ul> <li>local cache:单独使用本地Cache </li> </ul> <blockquote> 适用场景:单点应用/多点应用 <pre class="prettyprint"><span class="typ">LocalCacheFactory</span><span class="pun">.</span><span class="pln">getInstance</span><span class="pun">().</span><span class="kwd">set</span><span class="pun">(</span><span class="str">"foo"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"bar"</span><span class="pun">);</span><span class="pln"> </span><span class="typ"> LocalCacheFactory</span><span class="pun">.</span><span class="pln">getInstance</span><span class="pun">().</span><span class="kwd">get</span><span class="pun">(</span><span class="str">"foo"</span><span class="pun">);</span></pre> </blockquote> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1324813123124" target="_blank">http://www.open-open.com/lib/view/home/1324813123124</a></p>