Skip to content

Commit

Permalink
load acls into cache
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Nov 27, 2024
1 parent 7df8196 commit 698032a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions logic/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ var (
aclCacheMap = make(map[string]models.Acl)
)

func init() {
// load acls into cache
_ = listAcls()
}

// CreateDefaultAclNetworkPolicies - create default acl network policies
func CreateDefaultAclNetworkPolicies(netID models.NetworkID) {
if netID.String() == "" {
Expand Down Expand Up @@ -177,6 +172,9 @@ func InsertAcl(a models.Acl) error {
func GetAcl(aID string) (models.Acl, error) {
a := models.Acl{}
if servercfg.CacheEnabled() {
if len(aclCacheMap) == 0 {
_ = listAcls()
}
var ok bool
a, ok = getAclFromCache(aID)
if ok {
Expand Down

0 comments on commit 698032a

Please sign in to comment.