mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
vault: Update LRU on GetPolicy
This commit is contained in:
parent
55cee897f5
commit
91ca436aa9
1 changed files with 4 additions and 0 deletions
|
|
@ -84,6 +84,7 @@ func (ps *PolicyStore) GetPolicy(name string) (*Policy, error) {
|
|||
// Special case the root policy
|
||||
if name == "root" {
|
||||
p := &Policy{Name: "root"}
|
||||
ps.lru.Add(p.Name, p)
|
||||
return p, nil
|
||||
}
|
||||
|
||||
|
|
@ -102,6 +103,9 @@ func (ps *PolicyStore) GetPolicy(name string) (*Policy, error) {
|
|||
return nil, fmt.Errorf("failed to parse policy: %v", err)
|
||||
}
|
||||
p.Name = name
|
||||
|
||||
// Update the LRU cache
|
||||
ps.lru.Add(p.Name, p)
|
||||
return p, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue