public class IpStats extends Object
Modifier and Type | Field and Description |
---|---|
Map<Long,CaffeineCache> |
cacheMap
key: 时长,单位:秒
|
List<Long> |
durationList |
Constructor and Description |
---|
IpStats(TioConfig tioConfig,
Long[] durations) |
Modifier and Type | Method and Description |
---|---|
IpStat |
_get(Long duration,
ChannelContext channelContext,
boolean forceCreate,
boolean useProxyClient) |
void |
addDuration(Long duration)
添加监控时段,不要添加过多的时间段,因为每个时间段都要消耗一份内存,一般加一个时间段就可以了
|
void |
addDurations(Long[] durations)
添加监控时段,不要添加过多的时间段,因为每个时间段都要消耗一份内存,一般加一个时间段就可以了
|
void |
clear(Long duration)
清空监控数据
|
IpStat |
get(Long duration,
ChannelContext channelContext)
根据ip获取IpStat,如果缓存中不存在,则创建
|
IpStat |
get(Long duration,
ChannelContext channelContext,
boolean forceCreate)
根据ip获取IpStat,如果缓存中不存在,则根据forceCreate的值决定是否创建
|
String |
getCacheName(Long duration) |
ConcurrentMap<String,Serializable> |
map(Long duration) |
void |
removeDuration(Long duration)
删除监控时间段
|
Long |
size(Long duration) |
Collection<Serializable> |
values(Long duration) |
public final Map<Long,CaffeineCache> cacheMap
public void addDuration(Long duration)
duration
- 单位:秒public void addDurations(Long[] durations)
durations
- 单位:秒public void removeDuration(Long duration)
duration
- public void clear(Long duration)
public IpStat get(Long duration, ChannelContext channelContext)
duration
- channelContext
- public IpStat get(Long duration, ChannelContext channelContext, boolean forceCreate)
duration
- channelContext
- forceCreate
- public IpStat _get(Long duration, ChannelContext channelContext, boolean forceCreate, boolean useProxyClient)
duration
- channelContext
- forceCreate
- useProxyClient
- public ConcurrentMap<String,Serializable> map(Long duration)
public Collection<Serializable> values(Long duration)
Copyright © 2021. All rights reserved.