Skip to content

Commit

Permalink
chore: purge the previous cached
Browse files Browse the repository at this point in the history
  • Loading branch information
fufuok committed Mar 23, 2024
1 parent c659864 commit f2b50ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion web/fiber/middleware/blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ var (
)

// UseBlacklistCache 重新设置黑名单检查时缓存, 配置变化时可选再次调用, 由应用端 Start() Runtime() 调用
func UseBlacklistCache(capacity, lifetime uint32) (err error) {
func UseBlacklistCache(capacity, lifetime uint32) error {
useBlacklistLRU.Store(false)
PurgeBlacklistCache()

if capacity == 0 {
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions web/fiber/middleware/whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var (
// UseWhitelistCache 重新设置白名单检查时缓存, 配置变化时可选再次调用, 由应用端 Start() Runtime() 调用
func UseWhitelistCache(capacity, lifetime uint32) error {
useWhitelistLRU.Store(false)
PurgeWhitelistCache()

if capacity == 0 {
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion web/gin/middleware/blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ var (
)

// UseBlacklistCache 重新设置黑名单检查时缓存, 配置变化时可选再次调用, 由应用端 Start() Runtime() 调用
func UseBlacklistCache(capacity, lifetime uint32) (err error) {
func UseBlacklistCache(capacity, lifetime uint32) error {
useBlacklistLRU.Store(false)
PurgeBlacklistCache()

if capacity == 0 {
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions web/gin/middleware/whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var (
// UseWhitelistCache 重新设置白名单检查时缓存, 配置变化时可选再次调用, 由应用端 Start() Runtime() 调用
func UseWhitelistCache(capacity, lifetime uint32) error {
useWhitelistLRU.Store(false)
PurgeWhitelistCache()

if capacity == 0 {
return nil
}
Expand Down

0 comments on commit f2b50ac

Please sign in to comment.