Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

7.2 RedisPlugin


May 14, 2021 JFinal manual



RedisPlugin exists as JFinal Plugin, so redisPlugin needs to be configured in JFinalConfig when used, and here's the example code for redisPlugin configuration:

public class DemoConfig extends JFinalConfig {
public void configPlugin(Plugins me) {
The redis service used to cache the bbs module
RedisPlugin bbsRedis = new RedisPlugin("bbs", "localhost"); me.add(bbsRedis);

The redis service used to cache the news module
RedisPlugin newsRedis = new RedisPlugin("news", "192.168.3.9"); me.add(newsRedis);
}
}

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