이 콘텐츠는 선택한 언어로 제공되지 않습니다.
2.2. Creating CacheManagers
2.2.1. Create a New RemoteCacheManager 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Procedure 2.1. Configure a New RemoteCacheManager
- Use the
ConfigurationBuilder()
constructor to create a new configuration builder. The.addServer()
method adds a remote server, configured via the.host(<hostname|ip>)
and.port(<port>)
properties. - Create a new
RemoteCacheManager
using the supplied configuration. - Retrieve the default cache from the remote server.
2.2.2. Create a New Embedded Cache Manager 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Use the following instructions to create a new EmbeddedCacheManager without using CDI:
Procedure 2.2. Create a New Embedded Cache Manager
- Create a configuration XML file. For example, create the
my-config-file.xml
file on the classpath (in theresources/
folder) and add the configuration information in this file. - Use the following programmatic configuration to create a cache manager using the configuration file:
EmbeddedCacheManager manager = new DefaultCacheManager("my-config-file.xml"); Cache defaultCache = manager.getCache();
EmbeddedCacheManager manager = new DefaultCacheManager("my-config-file.xml"); Cache defaultCache = manager.getCache();
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The outlined procedure creates a new EmbeddedCacheManager using the configuration specified in
my-config-file.xml
.
2.2.3. Create a New Embedded Cache Manager Using CDI 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Use the following steps to create a new EmbeddedCacheManager instance using CDI:
Procedure 2.3. Use CDI to Create a New EmbeddedCacheManager
- Specify a default configuration:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Inject the default cache manager.
<!-- Additional configuration information here --> @Inject EmbeddedCacheManager cacheManager; <!-- Additional configuration information here -->
<!-- Additional configuration information here --> @Inject EmbeddedCacheManager cacheManager; <!-- Additional configuration information here -->
Copy to Clipboard Copied! Toggle word wrap Toggle overflow