@@ -530,9 +530,9 @@ func NewVbcTcInstanceDRegionRepositoryCache(repo VbcTcInstanceDRegionRepository,
530530// gaap
531531type TcGaapInstanceeInfosCache struct {
532532 Raw QaapTcInstanceInfoRepository
533- cache1 map [string ]* gaap.DescribeTCPListenersResponse
534- cache2 map [string ]* gaap.DescribeUDPListenersResponse
535- cache3 map [string ]* gaap.DescribeProxyGroupListResponse
533+ tcpCache map [string ]* gaap.DescribeTCPListenersResponse
534+ udpCache map [string ]* gaap.DescribeUDPListenersResponse
535+ groupCache map [string ]* gaap.DescribeProxyGroupListResponse
536536 lastReloadTime map [string ]time.Time
537537 reloadInterval time.Duration
538538 mu sync.Mutex
@@ -543,7 +543,7 @@ type TcGaapInstanceeInfosCache struct {
543543func (c * TcGaapInstanceeInfosCache ) GetTCPListenersInfo (instanceId string ) (* gaap.DescribeTCPListenersResponse , error ) {
544544 lrtime , exists := c .lastReloadTime [instanceId ]
545545 if exists && time .Now ().Sub (lrtime ) < c .reloadInterval {
546- namespace , ok := c .cache1 [instanceId ]
546+ namespace , ok := c .tcpCache [instanceId ]
547547 if ok {
548548 return namespace , nil
549549 }
@@ -553,15 +553,15 @@ func (c *TcGaapInstanceeInfosCache) GetTCPListenersInfo(instanceId string) (*gaa
553553 if err != nil {
554554 return nil , err
555555 }
556- c .cache1 [instanceId ] = tcpListeners
556+ c .tcpCache [instanceId ] = tcpListeners
557557 c .lastReloadTime [instanceId ] = time .Now ()
558558 level .Debug (c .logger ).Log ("msg" , "Get gaap Namespaces info from api" , "instanceId" , instanceId )
559559 return tcpListeners , nil
560560}
561561func (c * TcGaapInstanceeInfosCache ) GetUDPListenersInfo (instanceId string ) (* gaap.DescribeUDPListenersResponse , error ) {
562562 lrtime , exists := c .lastReloadTime [instanceId ]
563563 if exists && time .Now ().Sub (lrtime ) < c .reloadInterval {
564- namespace , ok := c .cache2 [instanceId ]
564+ namespace , ok := c .udpCache [instanceId ]
565565 if ok {
566566 return namespace , nil
567567 }
@@ -571,15 +571,15 @@ func (c *TcGaapInstanceeInfosCache) GetUDPListenersInfo(instanceId string) (*gaa
571571 if err != nil {
572572 return nil , err
573573 }
574- c .cache2 [instanceId ] = udpListeners
574+ c .udpCache [instanceId ] = udpListeners
575575 c .lastReloadTime [instanceId ] = time .Now ()
576576 level .Debug (c .logger ).Log ("msg" , "Get gaap Namespaces info from api" , "instanceId" , instanceId )
577577 return udpListeners , nil
578578}
579579func (c * TcGaapInstanceeInfosCache ) GetProxyGroupList (instanceId string ) (* gaap.DescribeProxyGroupListResponse , error ) {
580580 lrtime , exists := c .lastReloadTime [instanceId ]
581581 if exists && time .Now ().Sub (lrtime ) < c .reloadInterval {
582- namespace , ok := c .cache3 [instanceId ]
582+ namespace , ok := c .groupCache [instanceId ]
583583 if ok {
584584 return namespace , nil
585585 }
@@ -589,7 +589,7 @@ func (c *TcGaapInstanceeInfosCache) GetProxyGroupList(instanceId string) (*gaap.
589589 if err != nil {
590590 return nil , err
591591 }
592- c .cache3 [instanceId ] = proxyGroupList
592+ c .groupCache [instanceId ] = proxyGroupList
593593 c .lastReloadTime [instanceId ] = time .Now ()
594594 level .Debug (c .logger ).Log ("msg" , "Get gaap Namespaces info from api" , "instanceId" , instanceId )
595595 return proxyGroupList , nil
@@ -598,9 +598,9 @@ func (c *TcGaapInstanceeInfosCache) GetProxyGroupList(instanceId string) (*gaap.
598598func NewTcGaapInstanceeInfosCache (repo QaapTcInstanceInfoRepository , reloadInterval time.Duration , logger log.Logger ) QaapTcInstanceInfoRepository {
599599 cache := & TcGaapInstanceeInfosCache {
600600 Raw : repo ,
601- cache1 : map [string ]* gaap.DescribeTCPListenersResponse {},
602- cache2 : map [string ]* gaap.DescribeUDPListenersResponse {},
603- cache3 : map [string ]* gaap.DescribeProxyGroupListResponse {},
601+ tcpCache : map [string ]* gaap.DescribeTCPListenersResponse {},
602+ udpCache : map [string ]* gaap.DescribeUDPListenersResponse {},
603+ groupCache : map [string ]* gaap.DescribeProxyGroupListResponse {},
604604 lastReloadTime : map [string ]time.Time {},
605605 reloadInterval : reloadInterval ,
606606 logger : logger ,
0 commit comments