首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 互联网 >

应用memcached

2013-01-22 
使用memcached1.加载commons-pool-1.5.6.jar、java_memcached-release_2.6.6.jar、slf4j-api-1.6.1.jar、slf4

使用memcached

1.加载commons-pool-1.5.6.jar、java_memcached-release_2.6.6.jar、slf4j-api-1.6.1.jar、slf4j-simple-1.6.1.jar

2.创建memcached工具类:

public class MemcachedSpringTest {private MemCachedClient cachedClient;@Beforepublic void init() {ApplicationContext context = new ClassPathXmlApplicationContext("com/loujinhe/config/beans.xml");cachedClient = (MemCachedClient)context.getBean("memcachedClient");}@Testpublic void testMemcachedSpring() {UserBean user = new UserBean("lou", "jason");cachedClient.set("user", user);UserBean cachedBean = (UserBean)user;Assert.assertEquals(user, cachedBean);}}


热点排行