# ehcache **Repository Path**: luoyong/ehcache ## Basic Information - **Project Name**: ehcache - **Description**: ehcache example. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2014-08-27 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #### pom.xml ``` xml 4.0.0 name.luoyong.cache ehcache-example 0.0.1-SNAPSHOT jar ehcache-example UTF-8 net.sf.ehcache ehcache 2.8.3 ``` #### ehcache.xml ``` xml ``` #### java test ``` java public static void main(String[] args) throws Exception { CacheManager cacheManager = CacheManager.create(); Cache userCache = cacheManager.getCache("userCache"); Element luoyong = new Element("luoyong", new User("罗勇")); userCache.put(luoyong); for(int i=0; i<3; i++) { Thread.sleep(1300); Element luoyongElement = userCache.get("luoyong"); if(luoyongElement == null) { System.out.println("luoyongElement is not in userCache now"); System.exit(0); } User ly = (User)luoyongElement.getObjectValue(); System.out.println(ly.getName()); } } ```