What's difference between hibernate caching and Spring framework cache?

前端 未结 2 1370
感情败类
感情败类 2021-02-16 00:04

I have an application where I get the data from database (using hibernate). I want to load the cache (per user) with database state once per day and use the cache instead.

2条回答
  •  Happy的楠姐
    2021-02-16 00:40

    Hibernate has 2 levels of cache. 1. First level 2. Second level

    Second level chache is for the whole application and first level cache is for the current hibernate session. There is no cache available per user basis.

    Also if you are using spring managed beans + caching. There is a provision for you to cache the beans for entire application rather than for a user. (little uncertain on this)

    It sounds to me that you want to store the data in the user's session. ie., as long as the user is having an active session. Spring has a session scoped beans you may want to use these to cache the data per user.

提交回复
热议问题