All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.noear.wood.solon.CacheWrap Maven / Gradle / Ivy

The newest version!
package org.noear.wood.solon;

import org.noear.solon.data.cache.CacheService;
import org.noear.wood.cache.ICacheServiceEx;

import java.lang.reflect.Type;

/**
 * 缓存包装器
 *
 * @author noear
 * @since 1.10
 */
public class CacheWrap implements ICacheServiceEx, CacheService {
    public static CacheWrap wrap(ICacheServiceEx cache) {
        return new CacheWrap(cache);
    }


    ICacheServiceEx real;

    public CacheWrap(ICacheServiceEx real) {
        this.real = real;
    }

    @Override
    public void store(String key, Object obj, int seconds) {
        real.store(key, obj, seconds);
    }

    /**
     * @deprecated 2.5
     */
    @Deprecated
    @Override
    public Object get(String key) {
        return real.get(key);
    }

    @Override
    public  T get(String key, Type toType) {
        return (T) real.get(key, toType);
    }


    @Override
    public  T get(String key, Class clz) {
        return this.get(key, (Type) clz);
    }

    @Override
    public void remove(String key) {
        real.remove(key);
    }


    @Override
    public int getDefalutSeconds() {
        return real.getDefalutSeconds();
    }

    @Override
    public String getCacheKeyHead() {
        return real.getCacheKeyHead();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy