Skip to content

Commit

Permalink
kodofs/cached.NewFS; github.com/qiniu/x v1.12.11
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Sep 7, 2023
1 parent c8a48b4 commit 8b9accd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cached/cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cached

import (
"net/http"

"github.com/qiniu/x/http/fs/cached/remote"
"github.com/xushiwei/kodofs"
)

// -----------------------------------------------------------------------------------------

// NewFS creates a cached http.FileSystem to speed up listing directories and accessing file
// contents (optional, only when `cacheFile` is true). If `offline` is true, the cached http.FileSystem
// doesn't access `bkt *kodofs.Bucket`.
func NewFS(local string, bkt *kodofs.Bucket, cacheFile bool, offline ...bool) (fs http.FileSystem, err error) {
return remote.NewCached(local, bkt, nil, cacheFile, offline...)
}

// -----------------------------------------------------------------------------------------

0 comments on commit 8b9accd

Please sign in to comment.