criteria.setCacheable(true);這個方法是干什么用的


criteria.setCacheable(true);

一下是Criteria的底層源代碼

/**
* Enable caching of this query result, provided query caching is enabled
* for the underlying session factory.
*
* @param cacheable Should the result be considered cacheable; default is
* to not cache (false).
* @return this (for method chaining)
*/
public Criteria setCacheable(boolean cacheable);

意思是:

啟用查詢緩存結果,提供查詢緩存
*為底層會話工廠。
*
* @param緩存的結果應該被認為是默認緩存;
*不緩存(false)。
*“退貨(方法鏈接)

就是給criteria一個緩存


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM