Skip to content

Commit

Permalink
update to use whosonfirst/go-cache 0.1.0; update vendor deps
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisaaronland committed May 20, 2020
1 parent 5a22480 commit 007ecba
Show file tree
Hide file tree
Showing 122 changed files with 2,458 additions and 6,897 deletions.
27 changes: 10 additions & 17 deletions blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,28 @@ type BlobCache struct {

func init() {
ctx := context.Background()
c := NewBlobCache()

for _, scheme := range blob.DefaultURLMux().BucketSchemes() {
wof_cache.RegisterCache(ctx, scheme, c)
wof_cache.RegisterCache(ctx, scheme, NewBlobCache)
}
}

func NewBlobCache() wof_cache.Cache {
func NewBlobCache(ctx context.Context, uri string) (wof_cache.Cache, error) {

bucket, err := blob.OpenBucket(ctx, uri)

if err != nil {
return nil, err
}

c := &BlobCache{
TTL: 0,
misses: 0,
sets: 0,
evictions: 0,
bucket: bucket,
}

return c
}

func (c *BlobCache) Open(ctx context.Context, uri string) error {

bucket, err := blob.OpenBucket(ctx, uri)

if err != nil {
return err
}

c.bucket = bucket
return nil
return c, nil
}

func (c *BlobCache) Close(ctx context.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/whosonfirst/go-cache-blob
go 1.12

require (
github.com/whosonfirst/go-cache v0.0.2
gocloud.dev v0.18.0
github.com/whosonfirst/go-cache v0.1.0
gocloud.dev v0.19.0
)
43 changes: 43 additions & 0 deletions go.sum

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion vendor/github.com/aaronland/go-roster/default.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

191 changes: 191 additions & 0 deletions vendor/github.com/golang/groupcache/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

133 changes: 133 additions & 0 deletions vendor/github.com/golang/groupcache/lru/lru.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 007ecba

Please sign in to comment.