mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-14 17:42:03 -04:00
Bumps [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) from 1.1.3 to 1.1.4. - [Release notes](https://github.com/olekukonko/tablewriter/releases) - [Commits](https://github.com/olekukonko/tablewriter/compare/v1.1.3...v1.1.4) --- updated-dependencies: - dependency-name: github.com/olekukonko/tablewriter dependency-version: 1.1.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
27 lines
586 B
Go
27 lines
586 B
Go
package twwidth
|
|
|
|
import "github.com/olekukonko/tablewriter/pkg/twcache"
|
|
|
|
// widthCache stores memoized results of Width calculations to improve performance.
|
|
var widthCache *twcache.LRU[cacheKey, int]
|
|
|
|
type cacheKey struct {
|
|
eastAsian bool
|
|
str string
|
|
}
|
|
|
|
// SetCacheCapacity changes the cache size dynamically
|
|
// If capacity <= 0, disables caching entirely
|
|
func SetCacheCapacity(capacity int) {
|
|
mu.Lock()
|
|
defer mu.Unlock()
|
|
|
|
if capacity <= 0 {
|
|
widthCache = nil // nil = fully disabled
|
|
return
|
|
}
|
|
|
|
newCache := twcache.NewLRU[cacheKey, int](capacity)
|
|
widthCache = newCache
|
|
}
|