Package com.sishuok.spring.entity

Examples of com.sishuok.spring.entity.User


        EhCacheCacheManager cacheCacheManager = new EhCacheCacheManager();
        //设置底层的CacheManager
        cacheCacheManager.setCacheManager(ehcacheManager);

        Long id = 1L;
        User user = new User(id, "zhang", "zhang@gmail.com");

        //根据缓存名字获取Cache
        Cache cache = cacheCacheManager.getCache("user");
        //往缓存写数据
        cache.put(id, user);
View Full Code Here



    @Test
    public void testCache() {
        Long id = 1L;
        User user = new User(id, "zhang", "zhang@gmail.com");
        userService.save(user);

        //一定要复制一个 否则cache了(因为同一个JVM测试的)
        User user2 = new User(id, "zhang2", "zhang@gmail.com");
        userService.conditionUpdate(user2);

        userService.findById(id);
        userService.findByUsername("zhang2");
View Full Code Here


    @Test
    public void testCache() {
        Long id = 1L;
        User user = new User(id, "zhang", "zhang@gmail.com");
        userService.save(user);
        Assert.assertNotNull(userCache.get(id).get());
        userService.findById(id);
    }
View Full Code Here

        users.add(user);
    }


    public boolean canEvict(Cache userCache, Long id, String username) {
        User cacheUser = userCache.get(id, User.class);
        if (cacheUser == null) {
            return false;
        }
        return !cacheUser.getUsername().equals(username);
    }
View Full Code Here

TOP

Related Classes of com.sishuok.spring.entity.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.