package cache import ( "fiskerinc.com/modules/common" ) type CarDTCsCacheInterface interface { Exists(dtc common.DTC_ECU) bool Set(dtc common.DTC_ECU) } type CarDTCsCache struct { ringMap *RingMap } func NewCarDTCsCache(capacity int) CarDTCsCacheInterface { return &CarDTCsCache{ ringMap: NewRingMap(capacity), } } func (carDtcCache *CarDTCsCache) Exists(dtc common.DTC_ECU) bool { return carDtcCache.ringMap.Exists(dtc.CacheKey(), dtc.StatusByte) } func (carDtcCache *CarDTCsCache) Set(dtc common.DTC_ECU) { carDtcCache.ringMap.Put(dtc.CacheKey(), dtc.StatusByte) }