Java缓存系统 SHOP.COM Cache System

jopen 12年前
     <p>这是SHOP.COM 网站所使用的对象缓存系统,主要特性包括如下几个方面:</p>    <p>* 支持进程内和CS 模式的缓存结构<br />  * 可以进行水平扩展<br />  * 缓存对象可被存到磁盘中<br />  * 支持关联主键 <br />  * 非事务<br />  * 支持任意长度的主键和键值<br />  * 根据 TTL 进行自动垃圾回收<br />  * 可以运行于容器中或者是独立平台运行</p>    <p>示例代码:</p>    <pre class="brush:java; toolbar: true; auto-links: false;">List<SCClientManager> clientSet = new ArrayList<SCClientManager>(); SCClientFactory       clientFactory = ShopComCacheFactory.getClientFactory();  SCClientContext       context = clientFactory.newContext(); context.address(new InetSocketAddress(/*address 1*/, /*port number 1*/)); SCClientManager       manager = clientFactory.newClientManager(context); clientSet.add(manager);  // add additional managers for each cache server  myCache = new SCCache(new SCMultiManager(clientSet));  // see if your object is in the cache MyObject    obj = (MyObject)myCache.get(new SCDataBlock(myKey));  // if it's not, allocate it and add it to the cache if ( obj == null ) {     obj = new MyObject();     myCache.put(new SCDataBlock(myKey, obj)); }</pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1324812959499" target="_blank">http://www.open-open.com/lib/view/home/1324812959499</a></p>    <p></p>