Class CacheService
java.lang.Object
io.github.lunasaw.sip.common.cache.CacheService
缓存服务类 - 统一管理Caffeine缓存操作
- Author:
- luna
-
Constructor Summary
ConstructorsConstructorDescriptionCacheService
(com.github.benmanes.caffeine.cache.Cache<String, Object> deviceCache, com.github.benmanes.caffeine.cache.Cache<String, Object> subscribeCache, com.github.benmanes.caffeine.cache.Cache<String, Object> transactionCache, com.github.benmanes.caffeine.cache.Cache<String, Object> sipMessageCache) -
Method Summary
Modifier and TypeMethodDescriptionvoid
清空所有缓存获取缓存统计信息<T> Optional<T>
获取设备信息<T> Optional<T>
getSipMessage
(String messageId, Class<T> type) 获取SIP消息<T> Optional<T>
getSubscribe
(String subscribeId, Class<T> type) 获取订阅信息<T> Optional<T>
getTransaction
(String transactionId, Class<T> type) 获取事务信息void
存储设备信息void
putSipMessage
(String messageId, Object message) 存储SIP消息void
putSubscribe
(String subscribeId, Object subscribe) 存储订阅信息void
putTransaction
(String transactionId, Object transaction) 存储事务信息void
removeDevice
(String deviceId) 移除设备信息void
removeSipMessage
(String messageId) 移除SIP消息void
removeSubscribe
(String subscribeId) 移除订阅信息void
removeTransaction
(String transactionId) 移除事务信息
-
Constructor Details
-
CacheService
public CacheService(@Qualifier("deviceCaffeine") com.github.benmanes.caffeine.cache.Cache<String, Object> deviceCache, @Qualifier("subscribeCaffeine") com.github.benmanes.caffeine.cache.Cache<String, Object> subscribeCache, @Qualifier("transactionCaffeine") com.github.benmanes.caffeine.cache.Cache<String, Object> transactionCache, @Qualifier("sipMessageCaffeine") com.github.benmanes.caffeine.cache.Cache<String, Object> sipMessageCache)
-
-
Method Details
-
getDevice
获取设备信息 -
putDevice
存储设备信息 -
removeDevice
移除设备信息 -
getSubscribe
获取订阅信息 -
putSubscribe
存储订阅信息 -
removeSubscribe
移除订阅信息 -
getTransaction
获取事务信息 -
putTransaction
存储事务信息 -
removeTransaction
移除事务信息 -
getSipMessage
获取SIP消息 -
putSipMessage
存储SIP消息 -
removeSipMessage
移除SIP消息 -
getCacheStats
获取缓存统计信息 -
clearAllCaches
public void clearAllCaches()清空所有缓存
-