Skip to content

Commit

Permalink
add readme file
Browse files Browse the repository at this point in the history
add readme file
  • Loading branch information
leelance committed Jul 2, 2016
1 parent d3d9a71 commit 29a4b05
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions spring-boot-cache-redis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# spring-boot-cache-ehcache, 依赖spring-boot-parent
* [spring-boot](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/)
* [Ehcache2.10.*](http://www.ehcache.org/generated/2.10.2/html/ehc-all/)

```
@EnableCaching
@EnableScheduling
@SpringBootApplication
public class SimpleApplication {
public static void main(String[] args) {
SpringApplication.run(SimpleApplication.class, args);
}
}
@Component
@CacheConfig(cacheNames="CityService")
public class CityService {
Logger logger = LogManager.getLogger(getClass());
@Cacheable
public CityInfo getCity(int id, String city) {
logger.info("id: {}, city: {}", id, city);
return new CityInfo(id, city);
}
}
```
###application.properties
```
# IDENTITY (ContextIdApplicationContextInitializer)
spring.application.index=Cache.v1.1
spring.application.name=Cache Boot
#Server
server.port=80
#LOG
logging.config=classpath:log4j2.xml
spring.cache.type=ehcache
spring.cache.ehcache.config=classpath:ehcache.xml
```

0 comments on commit 29a4b05

Please sign in to comment.