RedisPlugin


RedisPlugin exists as a Plugin of JFinal, so you need to configure RedisPlugin in JFinalConfig when using it. The following is the RedisPlugin configuration example code:

public class DemoConfig extends JFinalConfig {
public void configPlugin(Plugins me) {
//redis service for caching bbs module
RedisPlugin bbsRedis = new RedisPlugin(" bbs", "localhost"); me.add(bbsRedis);

//redis service for caching news module
RedisPlugin newsRedis = new RedisPlugin("news", "192.168.3.9") ; me.add(newsRedis);
}
}

The above code creates two RedisPlugin objects, namely bbsRedis and newsRedis. The Cache object held by the first created RedisPlugin object will become the main cache object. The main cache object can be obtained directly through Redis.use(), otherwise you need to provide the cacheName parameter to obtain it, for example: Redis.use("news").