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

top.jfunc.weixin.cache.SpringAccessTokenCache Maven / Gradle / Ivy

package top.jfunc.weixin.cache;

import com.jfinal.weixin.sdk.cache.IAccessTokenCache;
import org.springframework.cache.Cache;

public class SpringAccessTokenCache implements IAccessTokenCache {
	private final static String ACCESS_TOKEN_PREFIX = "weixin:token:";
	private final Cache cache;

	public SpringAccessTokenCache(Cache cache){
		this.cache = cache;
	}
	@Override
	public String get(String key) {
		return cache.get(ACCESS_TOKEN_PREFIX + key, String.class);
	}

	@Override
	public void set(String key, String jsonValue) {
		cache.put(ACCESS_TOKEN_PREFIX + key, jsonValue);
	}

	@Override
	public void remove(String key) {
		cache.evict(ACCESS_TOKEN_PREFIX + key);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy