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

5.7 Cache


May 14, 2021 JFinal manual



ActiveRecord can use caching to greatly improve performance, and the following code is an example of Cache usage:

public void list() {
List<Blog> blogList = Blog. dao .findByCache("cacheName", "key", "select * from blog");
setAttr("blogList", blogList).render("list.html");
}

The cacheName in the findByCache method above needs to be configured in the ehcache .xml such as: slt;cache name"cacheName" ... & gt; 。 M odel.paginateByCache (...), Db.findByCache (...), Db.paginateByCache (...) M ethods provide cache support. When used, simply pass in cacheName, key, and configure the corresponding cacheName .xml in the ehccache module.