diff options
| author | chrislu <chris.lu@gmail.com> | 2025-07-18 00:26:58 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-07-18 00:26:58 -0700 |
| commit | b8cbe9b6b245a3dc6439c00c80a8d360952492fe (patch) | |
| tree | 99d9e6caac72c115bda597c2c93bfea4515dc621 /weed/s3api/s3api_bucket_config.go | |
| parent | 8bb47f3c03aaa2dd74e604a4aac1e08dd9e09c80 (diff) | |
| download | seaweedfs-b8cbe9b6b245a3dc6439c00c80a8d360952492fe.tar.xz seaweedfs-b8cbe9b6b245a3dc6439c00c80a8d360952492fe.zip | |
increase bucket config cache TTL
Diffstat (limited to 'weed/s3api/s3api_bucket_config.go')
| -rw-r--r-- | weed/s3api/s3api_bucket_config.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/s3api/s3api_bucket_config.go b/weed/s3api/s3api_bucket_config.go index 05abf3863..1c2bcbd98 100644 --- a/weed/s3api/s3api_bucket_config.go +++ b/weed/s3api/s3api_bucket_config.go @@ -30,13 +30,17 @@ type BucketConfig struct { } // BucketConfigCache provides caching for bucket configurations +// Cache entries are automatically updated/invalidated through metadata subscription events, +// so TTL serves as a safety fallback rather than the primary consistency mechanism type BucketConfigCache struct { cache map[string]*BucketConfig mutex sync.RWMutex - ttl time.Duration + ttl time.Duration // Safety fallback TTL; real-time consistency maintained via events } // NewBucketConfigCache creates a new bucket configuration cache +// TTL can be set to a longer duration since cache consistency is maintained +// through real-time metadata subscription events rather than TTL expiration func NewBucketConfigCache(ttl time.Duration) *BucketConfigCache { return &BucketConfigCache{ cache: make(map[string]*BucketConfig), @@ -54,7 +58,7 @@ func (bcc *BucketConfigCache) Get(bucket string) (*BucketConfig, bool) { return nil, false } - // Check if cache entry is expired + // Check if cache entry is expired (safety fallback; entries are normally updated via events) if time.Since(config.LastModified) > bcc.ttl { return nil, false } |
