@@ -14,6 +14,8 @@ import (
1414
1515 "github.com/pkg/errors"
1616 "go.uber.org/zap"
17+ "gopkg.d7z.net/gitea-pages/pkg/middleware/cache"
18+ "gopkg.d7z.net/gitea-pages/pkg/middleware/config"
1719
1820 "gopkg.d7z.net/gitea-pages/pkg/utils"
1921)
@@ -35,15 +37,15 @@ type Backend interface {
3537
3638type CacheBackend struct {
3739 backend Backend
38- config utils .KVConfig
40+ config config .KVConfig
3941 ttl time.Duration
4042}
4143
4244func (c * CacheBackend ) Close () error {
4345 return c .backend .Close ()
4446}
4547
46- func NewCacheBackend (backend Backend , config utils .KVConfig , ttl time.Duration ) * CacheBackend {
48+ func NewCacheBackend (backend Backend , config config .KVConfig , ttl time.Duration ) * CacheBackend {
4749 return & CacheBackend {backend : backend , config : config , ttl : ttl }
4850}
4951
@@ -113,12 +115,12 @@ func (c *CacheBackend) Open(ctx context.Context, client *http.Client, owner, rep
113115
114116type CacheBackendBlobReader struct {
115117 client * http.Client
116- cache utils .Cache
118+ cache cache .Cache
117119 base Backend
118120 maxSize int
119121}
120122
121- func NewCacheBackendBlobReader (client * http.Client , base Backend , cache utils .Cache , maxCacheSize int ) * CacheBackendBlobReader {
123+ func NewCacheBackendBlobReader (client * http.Client , base Backend , cache cache .Cache , maxCacheSize int ) * CacheBackendBlobReader {
122124 return & CacheBackendBlobReader {client : client , base : base , cache : cache , maxSize : maxCacheSize }
123125}
124126
@@ -173,7 +175,7 @@ func (c *CacheBackendBlobReader) Open(ctx context.Context, owner, repo, commit,
173175 if err = c .cache .Put (key , bytes .NewBuffer (allBytes )); err != nil {
174176 zap .L ().Warn ("缓存归档失败" , zap .Error (err ), zap .Int ("Size" , len (allBytes )), zap .Int ("MaxSize" , c .maxSize ))
175177 }
176- return & utils .CacheContent {
178+ return & cache .CacheContent {
177179 ReadSeekCloser : utils.NopCloser {
178180 ReadSeeker : bytes .NewReader (allBytes ),
179181 },
0 commit comments