https://github.com/superluminar-io/s3-caching-reader
S3 Caching Reader is a Go module that allows to use S3 as caching backend
https://github.com/superluminar-io/s3-caching-reader
aws caching golang s3
Last synced: 2 months ago
JSON representation
S3 Caching Reader is a Go module that allows to use S3 as caching backend
- Host: GitHub
- URL: https://github.com/superluminar-io/s3-caching-reader
- Owner: superluminar-io
- Created: 2020-04-04T13:57:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-07T13:05:55.000Z (about 6 years ago)
- Last Synced: 2025-06-01T01:47:01.351Z (about 1 year ago)
- Topics: aws, caching, golang, s3
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# S3 Caching Reader

S3 Caching Reader is a Go module that allows to use S3 as caching backend.
## Installation
```bash
go get github.com/superluminar-io/s3-caching-reader
```
## Usage
```go
package main
import (
"fmt"
"io/ioutil"
"time"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
rdr "github.com/superluminar-io/s3-caching-reader/reader"
)
func main() {
originFunc := func() (string, error) {
return fmt.Sprintf("something from origin at: %s", time.Now().String()), nil
}
sess := session.Must(session.NewSession())
s3Client := s3.New(sess)
r := rdr.NewReader(
"s3-caching-reader-test-bucket",
"my-key-generated-from-some-input",
originFunc,
10,
s3Client,
)
all, err := ioutil.ReadAll(r)
if err != nil {
panic(err)
}
fmt.Printf(string(all))
}
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)