# cache-support
**Repository Path**: xuyixs/cache-support
## Basic Information
- **Project Name**: cache-support
- **Description**: Cache support on java web stack
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2016-08-24
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Cache-Support
Cache-Support model used on DAO or Service in the J2EE stack. Enhance the speed of user access.
The idea of cache-support is add annotation on the methods of DAO or Service. Decoupled from the business.
So it is very flexible. besides, there provide a jsonUtil utility.
So far, this cache-support only support redis. it will be extend more in the next phase.
## Configuration
edit the spring configuration file. add as follows:
Redis Config Support
```
```
Codis Config Support
```
```
## Usage
### cache object
```
@Cacheable(
namespace = Constants.CACHE_NAMESPACE,
fieldsKey = {"#targetCode", "#dept", "#id"}
)
@Override
public MobileHomePageEntity queryMobileHomePage(String targetCode, String dept, Integer id) {
// DAO
}
```
### set expire time
```
@Cacheable(
namespace = Constants.CACHE_NAMESPACE,
fieldsKey = {"#targetCode", "#dept", "#id"},
expire = 5000
)
@Override
public Bar queryMobileHomePage(String targetCode, String dept, Integer id) {
// DAO or Service
}
```