Ehclass="tags" href="/tags/CACHE.html" title=cache>cache 1.5.0 User Guide - Cache Configuration 缓存配置(1)
class="MsoNormal" style="text-align: center;">(Ehclass="tags" href="/tags/CACHE.html" title=cache>cache 1.5.0 用户指南)
class="MsoNormal" style="text-align: center;">E_mail:jianglike18@163.con
class="MsoNormal" style="text-align: center;">Blog: http://blog.csdn.net/jianglike18
class="MsoNormal" style="text-align: center;">qq:29396597
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(注明:以下是一个ehclass="tags" href="/tags/CACHE.html" title=cache>cache.xml配置文件的例子)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><ehclass="tags" href="/tags/CACHE.html" title=cache>cache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
class="MsoNormal" style="margin: 0cm 0cm 0pt;">CacheManager Configuration
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(CacheManager 配置)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">==========================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">An ehclass="tags" href="/tags/CACHE.html" title=cache>cache.xml corresponds to a single CacheManager.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(一个ehclass="tags" href="/tags/CACHE.html" title=cache>cache.xml文件与一个CacheManager相对应。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">See instructions below or the ehclass="tags" href="/tags/CACHE.html" title=cache>cache schema (ehclass="tags" href="/tags/CACHE.html" title=cache>cache.xsd) on how to configure.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(如果配置查看下面的说明或ehclass="tags" href="/tags/CACHE.html" title=cache>cache的结构(ehclass="tags" href="/tags/CACHE.html" title=cache>cache.xsd))
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">System property tokens can be specified in this file which are replaced when the configuration
class="MsoNormal" style="margin: 0cm 0cm 0pt;">is loaded. For example multicastGroupPort=${multicastGroupPort} can be replaced with the
class="MsoNormal" style="margin: 0cm 0cm 0pt;">System property either from an environment variable or a system property specified with a
class="MsoNormal" style="margin: 0cm 0cm 0pt;">command line switch such as -DmulticastGroupPort=4446.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(系统属性特征可以在这个文件里设置,当配置被加载时系统属性会被替换。例如multicastGroupPort=${multicastGroupPort}可以被来自环境变量或命令行如-DmulticastGroupPort=4446的系统属性替换。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">DiskStore configuration
class="MsoNormal" style="margin: 0cm 0cm 0pt;">=======================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The diskStore element is optional. It must be configured if you have overflowToDisk
class="MsoNormal" style="margin: 0cm 0cm 0pt;">or diskPersistent enabled for any class="tags" href="/tags/CACHE.html" title=cache>cache. If it is not configured, a warning will be
class="MsoNormal" style="margin: 0cm 0cm 0pt;">issues and java.io.tmpdir will be used.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(DiskStore 配置
class="MsoNormal" style="margin: 0cm 0cm 0pt;">=======================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">diskStore元素是可选的。如果对于任何一个缓存你使overflowToDisk,diskPersistent可用,那么你必须配置diskStore元素。如果没有配置,会发出一个警告并使用java的临时目录java.io.tmpdir。
class="MsoNormal" style="margin: 0cm 0cm 0pt;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">diskStore has only one attribute - "path". It is the path to the directory where .data and .index files will be created.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">If the path is a Java System Property it is replaced by its value in the running VM.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(diskStore 只有一个属性“path”。后缀为.data 和 .index的文件都在该目录下创建。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The following class="tags" href="/tags/PROPERTIES.html" title=properties>properties are translated:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* class="tags" href="/tags/USER.html" title=user>user.home - User's home directory
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* class="tags" href="/tags/USER.html" title=user>user.dir - User's current working directory
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* java.io.tmpdir - Default temp file path
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(解释了下面的属性:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* class="tags" href="/tags/USER.html" title=user>user.home - 用户的主目录
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* class="tags" href="/tags/USER.html" title=user>user.dir – 用户当前的工作目录
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* java.io.tmpdir – 默认的临时目录)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> The following class="tags" href="/tags/PROPERTIES.html" title=properties>properties are translated:
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> * class="tags" href="/tags/USER.html" title=user>user.home - User's home directory
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> * class="tags" href="/tags/USER.html" title=user>user.dir - User's current working directory
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> * java.io.tmpdir - Default temp file path
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;">* ehclass="tags" href="/tags/CACHE.html" title=cache>cache.disk.store.dir - A system property you would normally specify on the command line
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> e.g. java -Dehclass="tags" href="/tags/CACHE.html" title=cache>cache.disk.store.dir=/u01/myapp/diskdir ...
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt; mso-char-indent-count: 2.0;">Subdirectories can be specified below the property e.g. java.io.tmpdir/one
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt; mso-char-indent-count: 2.0;">
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;">(解释了下面的属性:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 26.25pt; mso-char-indent-count: 2.5;">* class="tags" href="/tags/USER.html" title=user>user.home - 用户的主目录
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 26.25pt; mso-char-indent-count: 2.5;">* class="tags" href="/tags/USER.html" title=user>user.dir – 用户当前的工作目录
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 27pt; mso-char-indent-count: 2.57;">* java.io.tmpdir – 默认的临时目录
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 27pt; mso-char-indent-count: 2.57;">* ehclass="tags" href="/tags/CACHE.html" title=cache>cache.disk.store.dir 通常可以在命令行设置的系统属性
class="MsoNormal" style="margin: 0cm 0cm 0pt;">例如:java -Dehclass="tags" href="/tags/CACHE.html" title=cache>cache.disk.store.dir=/u01/myapp/diskdir ...
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt; mso-char-indent-count: 2.0;">子目录也可以被设置例如下面的例子java.io.tmpdir/one
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">-->
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><diskStore path="java.io.tmpdir"/>
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><!--
class="MsoNormal" style="margin: 0cm 0cm 0pt;">CacheManagerEventListener
class="MsoNormal" style="margin: 0cm 0cm 0pt;">=========================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
class="MsoNormal" style="margin: 0cm 0cm 0pt;">which is notified when Caches are added or removed from the CacheManager.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(CacheManagerEventListener (缓存事件监听)
class="MsoNormal" style="margin: 0cm 0cm 0pt 15.75pt; text-indent: -15.75pt; mso-char-indent-count: -1.5;"> 设置CacheManagerEventListenerFactory用于创建一个CacheManagerPeerProvider,用于提醒当CacheManager中的缓存增加或者删除时
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 5.25pt; mso-char-indent-count: .5;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The class="tags" href="/tags/ATTRIBUTES.html" title=attributes>attributes of CacheManagerEventListenerFactory are:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* class - a fully qualified factory class name
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* class="tags" href="/tags/PROPERTIES.html" title=properties>properties - comma separated class="tags" href="/tags/PROPERTIES.html" title=properties>properties having meaning only to the factory.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(CacheManagerEventListenerFactory类的属性:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 26.25pt; mso-char-indent-count: 2.5;">*class:完整的工厂类名称
*class="tags" href="/tags/PROPERTIES.html" title=properties>properties:逗号分割该工厂类属性含义
)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets the fully qualified class name to be registered as the CacheManager event listener.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The events include:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* adding a Cache
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* removing a Cache
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(设置完整的类名注册为CacheManager的事件监听。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">包含如下事件:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt; mso-char-indent-count: 2.0;">* 增加缓存
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt; mso-char-indent-count: 2.0;">* 移除缓存)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
class="MsoNormal" style="margin: 0cm 0cm 0pt;">of the implementer to safely handle the potential performance and thread safety issues
class="MsoNormal" style="margin: 0cm 0cm 0pt;">depending on what their listener is doing.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">If no class is specified, no listener is created. There is no default.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(监听的回调函数可以是同步和异步。实现者有职责安全处理潜在的性能和线程安全问题,但这依赖监听器是怎么做的。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 5.25pt; mso-char-indent-count: .5;">如果没有指定监听类,监听器就不会被创建,也没有默认的。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">-->
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><class="tags" href="/tags/CACHE.html" title=cache>cacheManagerEventListenerFactory class="" class="tags" href="/tags/PROPERTIES.html" title=properties>properties=""/>
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><!--
class="MsoNormal" style="margin: 0cm 0cm 0pt;">CacheManagerPeerProvider
class="MsoNormal" style="margin: 0cm 0cm 0pt;">========================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(Enable for distributed operation)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Specifies a CacheManagerPeerProviderFactory which will be used to create a
class="MsoNormal" style="margin: 0cm 0cm 0pt;">CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(CacheManagerPeerProvider
class="MsoNormal" style="margin: 0cm 0cm 0pt;">========================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">设置一个用于创建CacheManagerPeerProvider类的工厂类CacheManagerPeerProviderFactory,在集群环境里CacheManagerPeerProvider类用于查找其他的CacheManagers。
class="MsoNormal" style="margin: 0cm 0cm 0pt;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The class="tags" href="/tags/ATTRIBUTES.html" title=attributes>attributes of class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerProviderFactory are:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* class - a fully qualified factory class name
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* class="tags" href="/tags/PROPERTIES.html" title=properties>properties - comma separated class="tags" href="/tags/PROPERTIES.html" title=properties>properties having meaning only to the factory.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(CacheManagerEventListenerFactory类的属性:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 26.25pt; mso-char-indent-count: 2.5;">*class:完整的工厂类名称
*class="tags" href="/tags/PROPERTIES.html" title=properties>properties:逗号分割属性,该属性仅对该工厂类有意义
)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Ehclass="tags" href="/tags/CACHE.html" title=cache>cache comes with a built-in RMI-based distribution system with two means of discovery of
class="MsoNormal" style="margin: 0cm 0cm 0pt;">CacheManager peers participating in the cluster:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* automatic, using a multicast group. This one automatically discovers peers and detects
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> changes such as peers entering and leaving the group
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> configuration time.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(Ehclass="tags" href="/tags/CACHE.html" title=cache>cache 配备了内置的基于RMI(远程方法接口)分布式机制,该机制有两种发现集群中共享的CacheManager peer对象的方法:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">*自动的,使用多点传送组。这一个自动发现同行和检测的变化,如同龄人进入和离开组
class="MsoNormal" style="margin: 0cm 0cm 0pt;">*手动的,使用手动的rmiURL配置。在配置时固定的peer组就被提供了。
class="MsoNormal" style="margin: 0cm 0cm 0pt;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Configuring Automatic Discovery:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Automatic discovery is configured as per the following example:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(配置自动查找:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">自动查找按照如下的例子进行配置)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerProviderFactory
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="net.sf.ehclass="tags" href="/tags/CACHE.html" title=cache>cache.distribution.RMICacheManagerPeerProviderFactory"
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="tags" href="/tags/PROPERTIES.html" title=properties>properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446, timeToLive=32"/>
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Valid class="tags" href="/tags/PROPERTIES.html" title=properties>properties are:(有效的参数:)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* peerDiscovery (mandatory) - specify "automatic"
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* multicastGroupAddress (mandatory) - specify a valid multicast group address
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> traffic
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* timeToLive - specify a value between 0 and 255 which determines how far the packets will
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> propagate.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(* peerDiscovery(强制的)-设置成“automatic”值
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* multicastGroupAddress (强制的) –设置正确的多点传送组地址
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* multicastGroupPort (强制的) – 为组播流量心跳设置一个专门的端口。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* timeToLive – 设置一个0到255的值,该值决定信息发送的网络范围。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> By convention, the restrictions are:(根据习惯,约束如下:)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 0 - the same host (0 – 相同的主机)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 1 - the same subnet (1- 相同的子网)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 32 - the same site (32 – 相同的站点)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 64 - the same region (64 – 相同的区域)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 128 - the same continent (128 – 系统的地区)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 255 – unrestricted(255 – 无限制)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Configuring Manual Discovery:(配置手动查找:)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Manual discovery is configured as per the following example:(手动查找按照如下的例子进行配置)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerProviderFactory class=
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> "net.sf.ehclass="tags" href="/tags/CACHE.html" title=cache>cache.distribution.RMICacheManagerPeerProviderFactory"
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="tags" href="/tags/PROPERTIES.html" title=properties>properties="peerDiscovery=manual,
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> | //server1:40000/sampleCache2|//server2:40000/sampleCache2"
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> propertySeparator="," />
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Valid class="tags" href="/tags/PROPERTIES.html" title=properties>properties are:(有效参数:)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* peerDiscovery (mandatory) - specify "manual"(设置“manual”)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form //hostname:port
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The hostname is the hostname of the remote CacheManager peer. The port is the listening
class="MsoNormal" style="margin: 0cm 0cm 0pt;">port of the RMICacheManagerPeerListener of the remote CacheManager peer.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(设置通道,各rmiUrls通道按“//主机名:端口”形式以逗号分隔。主机名是远程CacheManager peer的名字。端口是远程CacheManager peer的RMICacheManagerPeerListener监听端口。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">-->
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerProviderFactory
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="net.sf.ehclass="tags" href="/tags/CACHE.html" title=cache>cache.distribution.RMICacheManagerPeerProviderFactory"
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="tags" href="/tags/PROPERTIES.html" title=properties>properties="peerDiscovery=automatic,
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> multicastGroupAddress=230.0.0.1,
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> multicastGroupPort=4446, timeToLive=1"
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> propertySeparator=","
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> />
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><!--
class="MsoNormal" style="margin: 0cm 0cm 0pt;">CacheManagerPeerListener
class="MsoNormal" style="margin: 0cm 0cm 0pt;">========================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(Enable for distributed operation)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Specifies a CacheManagerPeerListenerFactory which will be used to create a
class="MsoNormal" style="margin: 0cm 0cm 0pt;">CacheManagerPeerListener, which
class="MsoNormal" style="margin: 0cm 0cm 0pt;">listens for messages from class="tags" href="/tags/CACHE.html" title=cache>cache replicators participating in the cluster.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(CacheManagerPeerListener
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 15.75pt; mso-char-indent-count: 1.5;">用于分布式操作
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 15.75pt; mso-char-indent-count: 1.5;">设置一个用于创建CacheManagerPeerListener监听 对象的CacheManagerPeerListenerFactory工厂类,CacheManagerPeerListener对象监听来自集群中缓存复制分享的消息。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 15.75pt; mso-char-indent-count: 1.5;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The class="tags" href="/tags/ATTRIBUTES.html" title=attributes>attributes of class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerListenerFactory are:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">class - a fully qualified factory class name
class="MsoNormal" style="margin: 0cm 0cm 0pt;">class="tags" href="/tags/PROPERTIES.html" title=properties>properties - comma separated class="tags" href="/tags/PROPERTIES.html" title=properties>properties having meaning only to the factory.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerListenerFactory类的属性:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 15.75pt; mso-char-indent-count: 1.5;">class – 完成有效的工厂类名
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 15.75pt; mso-char-indent-count: 1.5;">class="tags" href="/tags/PROPERTIES.html" title=properties>properties -逗号分割属性,该属性仅对该工厂类有意义。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Ehclass="tags" href="/tags/CACHE.html" title=cache>cache comes with a built-in RMI-based distribution system. The listener component is
class="MsoNormal" style="margin: 0cm 0cm 0pt;">RMICacheManagerPeerListener which is configured using
class="MsoNormal" style="margin: 0cm 0cm 0pt;">RMICacheManagerPeerListenerFactory. It is configured as per the following example:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(Ehclass="tags" href="/tags/CACHE.html" title=cache>cache 配备了内置的基于RMI(远程方法接口)分布式机制。监听组件是用RMICacheManagerPeerListenerFactory 类配置的RMICacheManagerPeerListener类。它是按照如下的例子进行配置。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerListenerFactory
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="net.sf.ehclass="tags" href="/tags/CACHE.html" title=cache>cache.distribution.RMICacheManagerPeerListenerFactory"
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="tags" href="/tags/PROPERTIES.html" title=properties>properties="hostName=fully_qualified_hostname_or_ip,
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> port=40001,
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> socketTimeoutMillis=120000"
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> propertySeparator="," />
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">All class="tags" href="/tags/PROPERTIES.html" title=properties>properties are optional. They are:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* hostName - the hostName of the host the listener is running on. Specify
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> where the host is multihomed and you want to control the interface over which cluster
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> messages are received. Defaults to the host name of the default interface if not
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> specified.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* port - the port the listener listens on. This defaults to a free port if not specified.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">* socketTimeoutMillis - the number of ms client sockets will stay open when sending
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> messages to the listener. This should be long enough for the slowest message.
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> If not specified it defaults 120000ms.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(所有的配置项都是可选的:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* hostName – 监听运行的主机名。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">* port – 监听器监听的端口,如果没有指定默认为空闲的端口,)
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">*socketTimeoutMillis – 客户端sockets发消息到监听器后持续打开的时间,该时间对于最慢的信息应该足够长,如果没有指定默认为120000毫秒。
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><class="tags" href="/tags/CACHE.html" title=cache>cacheManagerPeerListenerFactory
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> class="net.sf.ehclass="tags" href="/tags/CACHE.html" title=cache>cache.distribution.RMICacheManagerPeerListenerFactory"/>
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;"><!--
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Cache configuration (缓存配置)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">===================
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The following class="tags" href="/tags/ATTRIBUTES.html" title=attributes>attributes are required.(如下属性是必须的:)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">name:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets the name of the class="tags" href="/tags/CACHE.html" title=cache>cache. This is used to identify the class="tags" href="/tags/CACHE.html" title=cache>cache. It must be unique.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(名称(name):)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(设置缓存的名称。用于唯一标示缓存。名字必须唯一。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">maxElementsInMemory:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets the maximum number of objects that will be created in memory
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(内存中保持的对象数量(maxElementsInMemory):
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 设置内存中可以创建的最大对象数目。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">maxElementsOnDisk:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets the maximum number of objects that will be maintained in the DiskStore
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The default value is zero, meaning unlimited.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(DiskStore中保持的对象数量:
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 设置磁盘中可允许的最大对象数目,默认为0,即无限制。
class="MsoNormal" style="margin: 0cm 0cm 0pt;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">eternal:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets whether elements are eternal. If eternal, timeouts are ignored and the
class="MsoNormal" style="margin: 0cm 0cm 0pt;">element is never expired.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(永久的(eternal):
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">设置对象是否为永久的,如果是,超时设定被忽略且对象不过期。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">overflowToDisk:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets whether elements can overflow to disk when the memory store
class="MsoNormal" style="margin: 0cm 0cm 0pt;">has reached the maxInMemory limit.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(转存到磁盘(overflowToDisk):
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">当内存达到maxInMemory的最大限制,设置元素是否可以转存到磁盘。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The following class="tags" href="/tags/ATTRIBUTES.html" title=attributes>attributes and elements are optional.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(下面的属性和元素是可选的:)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">timeToIdleSeconds:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets the time to idle for an element before it expires.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">i.e. The maximum amount of time between accesses before an element expires
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Is only used if the element is not eternal.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Optional attribute. A value of 0 means that an Element can idle for infinity.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The default value is 0.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(空闲最长时间(timeToIdleSeconds)
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">设置元素的过期之前的空闲时间,也就是说元素在访问和过期之间的最大的时间总计。仅在当元素不是永久的情况下使用。)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">timeToLiveSeconds:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Sets the time to live for an element before it expires.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">i.e. The maximum time between creation time and when an element expires.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Is only used if the element is not eternal.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Optional attribute. A value of 0 means that and Element can live for infinity.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The default value is 0.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(象生存最长时间(timeToLiveSeconds)
class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 设置对象过期之前的生存时间。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;">也就是说,元素从创建到过期之间的最大的时间总计。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;">在当元素不是永久的情况下使用。可选的属性,值为0表示元素可以无限生存。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;">默认值为0
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 5.25pt; mso-char-indent-count: .5;">)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">diskPersistent:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">Whether the disk store persists between restarts of the Virtual Machine.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">The default value is false.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(是否在磁盘上持久化:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 5.25pt; mso-char-indent-count: .5;">指重启jvm后,数据是否有效。默认为false)
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">clearOnFlush:
class="MsoNormal" style="margin: 0cm 0cm 0pt;">class="tags" href="/tags/CACHE.html" title=cache>cache parameter. It determines whether the MemoryStore should be cleared when flush()
class="MsoNormal" style="margin: 0cm 0cm 0pt;">is called on the class="tags" href="/tags/CACHE.html" title=cache>cache. By default, the MemoryStore is cleared. Useful is you want to
class="MsoNormal" style="margin: 0cm 0cm 0pt;">back up a class="tags" href="/tags/CACHE.html" title=cache>cache to the file system without clearing the MemoryStore.
class="MsoNormal" style="margin: 0cm 0cm 0pt;">
class="MsoNormal" style="margin: 0cm 0cm 0pt;">(执行flush方法后清空:
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">缓存参数。当flush()方法在缓存中被调用后,决定内存存储是否被清除。默认的是被清除。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">如果你想不清除内存存储的情况下,备份缓存到文件系统这个参数是比较有用的。
class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 10.5pt; mso-char-indent-count: 1.0;">)