Caching Grails缓存redis版本1.1.0插件编译错误

Caching Grails缓存redis版本1.1.0插件编译错误,caching,grails,redis,Caching,Grails,Redis,我将缓存redis插件添加到Grails2.5.1应用程序中,编译失败。类GrailsRedisCache未从接口org.springframework.Cache.Cache实现方法Cache.ValueWrapper putIfAbsent(对象var1,对象var2)。Grails 2.5.1和cache 1.1.8插件是否有新的Redis缓存插件 BuildConfig.groovy 编译“:缓存:1.1.8” 编译“org.grails.plugins:cacheredis:1.1.0

我将缓存redis插件添加到Grails2.5.1应用程序中,编译失败。类GrailsRedisCache未从接口org.springframework.Cache.Cache实现方法Cache.ValueWrapper putIfAbsent(对象var1,对象var2)。Grails 2.5.1和cache 1.1.8插件是否有新的Redis缓存插件

BuildConfig.groovy 编译“:缓存:1.1.8” 编译“org.grails.plugins:cacheredis:1.1.0”

putIfAbsent方法的可能实现。

在GitHub上实现了该方法。不知道为什么插件没有在上发布。

@SuppressWarnings(“未选中”)
@凌驾
public ValueWrapper putIfAbsent(最终对象键、最终对象值){
最后一个字节[]k=computeKey(键);
return(ValueWrapper)模板。execute(new RedisCallback()){
public ValueWrapper doInRedis(重新连接)抛出DataAccessException{
等待锁定(连接);
字节[]bs=connection.get(computeKey(键));
如果(bs==null){
连接。多();
set(k,template.getValueSerializer().serialize(value));
connection.zAdd(setName,0,k);
//配置过期时,将密钥时间设置为有效。
如果(ttl>永不过期){
连接。过期(k,ttl);
expire(setName,ttl);
}
connection.exec();
}
bs=connection.get(computeKey(键));
返回(bs==null?null:newValueWrapper(template.getValueSerializer().deserialize(bs));
}
},对);
}

缓存redis版本1.1.2-SNAPSHOT已发布并解决此问题


compile':cache redis:1.1.2-SNAPSHOT'

不,redis 1.1.0是grails 2.x行中的最新版本。似乎可以通过调用get()实现缺少的方法(putIfAbsent()),如果结果为null,则调用put()。。。我如何为这个Redis插件做出贡献?
.../plugins/cache-redis-1.1.0/src/java/grails/plugin/cache/redis/GrailsRedisCache.java:39: error: GrailsRedisCache is not abstract and does not override abstract method putIfAbsent(Object,Object) in Cache
@Override
public ValueWrapper putIfAbsent(Object o, Object o1) {
    ValueWrapper val = get(o);

    if (null != val) {
        return val;
    }

    put(o, o1);
    return get(o);
}
@SuppressWarnings("unchecked")
@Override
public ValueWrapper putIfAbsent(final Object key, final Object value) {
    final byte[] k = computeKey(key);
    return (ValueWrapper) template.execute(new RedisCallback<ValueWrapper>() {
        public ValueWrapper doInRedis(RedisConnection connection) throws DataAccessException {
            waitForLock(connection);
            byte[] bs = connection.get(computeKey(key));

            if (bs == null) {
                connection.multi();
                connection.set(k, template.getValueSerializer().serialize(value));
                connection.zAdd(setName, 0, k);

                // Set key time to live when expiration has been configured.
                if (ttl > NEVER_EXPIRE) {
                    connection.expire(k, ttl);
                    connection.expire(setName, ttl);
                }

                connection.exec();
            }

            bs = connection.get(computeKey(key));
            return (bs == null ? null : newValueWrapper(template.getValueSerializer().deserialize(bs)));
        }
    }, true);
}