英文:
Does Jetty server require EhCache core library as dependency?
问题
-
我的Java应用程序正在使用Jetty(v9.4)作为服务器。我想知道它是否需要
ehcache-core作为依赖,例如用于会话管理等方面? -
当应用程序是无状态的时候,是否需要
ehcache-core?
英文:
-
My Java application is using Jetty (v9.4) as server. I am wondering whether it requires
ehcache-coreas dependency for any reason such as Session management etc? -
Would
ehcache-corebe required when the application is stateless?
答案1
得分: 2
Eclipse Jetty在其任何组件中都不依赖于ehcache。
- 服务器拥有一个
SessionIdManager- 管理每个
ServletContext(例如:每个部署的Web应用)- 每个
ServletContext有一个SessionCache- 每个
SessionCache有一个SessionDataStore
- 每个
- 每个
- 管理每个
SessionIdManager没有真正的选项,只有一个实现。
对于SessionCache,Jetty中有以下实现:
- 如果未配置,将会有一个
DefaultSessionCache(它本身无法配置) session-cache-hash- 将使用内存中的HashMap来跟踪会话。session-cache-null- 不会在ServletContext级别缓存Session(这在某些情况下是非常有用的配置,只是意味着您会更多地依赖于SessionDataStore)
SessionCache可以在每个ServletContext中进行特定配置,还可以通过SessionCacheFactory实现在服务器级别进行配置,该实现将在部署新Web应用程序时使用。
对于SessionDataStore,您可以使用以下几种实现:
-
Null - 不存储会话(仅依赖于缓存)
-
File - 将会话持久化到磁盘
-
JDBC - 将会话持久化到数据源
-
Cache - 将会话持久化到Memcache
-
GCloud - 将会话持久化到Google Cloud Storage
-
Mongo - 将会话持久化到MongoDB
-
Infinispan - 将会话持久化到Infinispan
英文:
Eclipse Jetty has no dependency on ehcache in any of it's components.
- Server has a
SessionIdManager- Manages each
ServletContext(eg: each deployed webapp)- A
SessionCacheperServletContext- A
SessionDataStoreperSessionCache
- A
- A
- Manages each
There's no real options for SessionIdManager there's just one implementation.
For SessionCache you have the following implementations in Jetty.
- If unconfigured, you'll have a
DefaultSessionCache(which itself cannot be configured) session-cache-hash- will use an in memoryHashMapto track sessions.session-cache-null- will not cacheSessionatServletContextlevel (this is sometimes a very useful configuration, just means you'll lean more on theSessionDataStore)
The SessionCache can be specifically configured at each ServletContext, but it can also be configured at the Server level via a SessionCacheFactory implementation that will be used when a new webapp is deployed.
For SessionDataStore you have several implementations available.
-
Null - no storage of Sessions (you rely on Cache only)
-
File - Session persistence to disk
-
JDBC - Session persistence to a DataSource
-
Cache - Session persistence to Memcache
-
GCloud - Session persistence to Google Cloud Storage
-
Mongo - Session persistence to Mongo DB
-
Infinispan - Session persistence to Infinispan
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论