java.lang.Object
org.miaixz.bus.cache.support.metrics.ZookeeperMetrics
- All Implemented Interfaces:
Metrics
ZooKeeper缓存命中率统计实现
基于ZooKeeper实现的分布式缓存命中率统计,使用Curator框架操作ZooKeeper, 支持分布式原子计数器,适用于分布式环境下的缓存命中率统计。
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.miaixz.bus.cache.Metrics
Metrics.Snapshot -
Constructor Summary
ConstructorsConstructorDescriptionZookeeperMetrics(String zkServer) 构造方法ZookeeperMetrics(String zkServer, String productName) 构造方法 -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.cache.Metrics
summaryName
-
Constructor Details
-
ZookeeperMetrics
构造方法- Parameters:
zkServer- ZooKeeper服务器地址
-
ZookeeperMetrics
构造方法- Parameters:
zkServer- ZooKeeper服务器地址productName- 产品名称,用于命名空间隔离
-
-
Method Details
-
hitIncr
增加命中次数 -
reqIncr
增加请求次数 -
getHitting
获取缓存命中率统计信息- Specified by:
getHittingin interfaceMetrics- Returns:
- 缓存命中率统计映射,键为缓存模式/分组名称,值为HittingDO对象
-
reset
重置指定缓存模式的命中率统计 -
resetAll
public void resetAll()重置所有缓存模式的命中率统计 -
tearDown
@PreDestroy public void tearDown()销毁方法使用@PreDestroy注解,在Bean销毁时等待队列处理完毕并关闭执行器
-