<commit_before># nutz-plugins-wkcache 方法缓存

pom.xml
```
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutz-integration-jedis</artifactId>
            <version>1.r.62-SNAPSHOT</version>
        </dependency>
        <dependency>
             <groupId>org.nutz</groupId>
             <artifactId>nutz-plugins-wkcache</artifactId>
             <version>1.r.62-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.9.0</version>
            <scope>provided</scope>
        </dependency>
```
加载ioc对象jedis及wkcache
```
@IocBy(type = ComboIocProvider.class, args = {"*json", "config/ioc/", "*anno", "cn.wizzer", "*jedis", "*wkcache"})
```
redis.properties 配置文件
```
redis.host=localhost
redis.port=6379
redis.timeout=2000
redis.max_redir=10
redis.database=0
redis.maxTotal=100
#redis.password=<PASSWORD>
#redis集群模式设置 redis.mode=cluster
redis.mode=normal
#redis.nodes=
```
## 示例代码


```

@IocBean(args = {"refer:dao"})
@CacheDefaults(cacheName = "goods_product",cacheLiveTime = 3000)
//设置缓存名及失效时间(单位秒),如不设置失效时间则要手动删除缓存,缓存才能得到更新
public class GoodsProductServiceImpl extends BaseServiceImpl<Goods_product> implements GoodsProductService {
    public GoodsProductServiceImpl(Dao dao) {
        super(dao);
    }

    @CacheResult(cacheKey = "${args[0]}_${args[1]}_${args[2]}")
    //可以通过el表达式获取传递的参数作为cacheKey
    public int getPrice(String goodsId, String productId, String memberId) {
        //todo
        return 0;
    }

    @CacheResult<commit_msg>update: 更新wkcache方法缓存文档<commit_after># nutz-plugins-wkcache 方法缓存

pom.xml
```
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutz-integration-jedis</artifactId>
            <version>1.r.62-SNAPSHOT</version>
        </dependency>
        <dependency>
             <groupId>org.nutz</groupId>
             <artifactId>nutz-plugins-wkcache</artifactId>
             <version>1.r.62-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.9.0</version>
            <scope>provided</scope>
        </dependency>
```
加载ioc对象jedis及wkcache
```
@IocBy(type = ComboIocProvider.class, args = {"*json", "config/ioc/", "*anno", "cn.wizzer", "*jedis", "*wkcache"})
```
redis.properties 配置文件
```
redis.host=localhost
redis.port=6379
redis.timeout=2000
redis.max_redir=10
redis.database=0
redis.maxTotal=100
#redis.password=<PASSWORD>
#redis集群模式设置 redis.mode=cluster
redis.mode=normal
#redis.nodes=
```
## 示例代码


```

@IocBean(args = {"refer:dao"})
@CacheDefaults(cacheName = "goods_product",cacheLiveTime = 3000)
//设置缓存名及失效时间(单位秒),如不设置失效时间则要手动删除缓存,缓存才能得到更新
public class GoodsProductServiceImpl extends BaseServiceImpl<Goods_product> implements GoodsProductService {
    public GoodsProductServiceImpl(Dao dao) {
        super(dao);
    }

    @CacheResult(cacheKey = "${args[0]}_${args[1]}_${args[2]}")
    //可以通过el表达式获取传递的参数作为cacheKey
    public int getPrice(String goodsId, String productId, String memberId) {
        //todo
        return 0;
    }
    
    @CacheResult(cacheKey = "${args[0].id}_${args[0].loginname}")
    public Object getObjData(Member_user user) {
        //todo
        return obj;
    }

    @CacheResult
{'fraction_non_alphanumeric': 0.14713734796796202, 'fraction_numerical': 0.018985464253930585, 'mean_word_length': 3.209737827715356, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3608967', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1279, 'n_words': 161}